OBPIH-7569 java.util.Date fields should default to server timezone when using g:datePicker#5617
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## release/0.9.6 #5617 +/- ##
===============================================
Coverage ? 8.48%
Complexity ? 1118
===============================================
Files ? 712
Lines ? 45620
Branches ? 10915
===============================================
Hits ? 3869
Misses ? 41173
Partials ? 578 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| fieldType="${Date}" | ||
| precision="minute" | ||
| relativeYears="[-20..0]" | ||
| noSelection="['':'']"/> |
There was a problem hiding this comment.
All these changes to gsps is adding fieldType="${Date}". There is no other change (other than splitting the attrs into multiple lines)
I apologize for the 28 file change. I decided it was better to add fieldType="${Date}" to all the existing date pickers (instead of adding fieldType="${Instant}" to all the refactored ones) because we eventually want to refactor all of these to use Instant and doing it this way means we can remove the fieldType once we've refactored a field to use Instant (as opposed to needing to remember to add fieldType="${Instant}" to all fields that we refactor). Once we refactor all fields then we can remove the fieldType attr and logic entirely.
| // which uses the server timezone. We want to use the user's timezone instead. | ||
| if (attrs.value == null && attrs.default == null) { | ||
| attrs.value = GregorianCalendar.from(ZonedDateTime.now(zoneId)) | ||
| } |
There was a problem hiding this comment.
I realized I could remove the check on attrs.value == null by moving this into a case in the switch block above
|
Awesome work! Once again, thanks for helping me with this ticket! |
✨ Description of Change
Link to GitHub issue or Jira ticket: https://pihemr.atlassian.net/browse/OBPIH-7569
Description: Add a new fieldType attr to g:datePicker so that we can pre-serve the existing behaviour of defaulting to the current time in UTC when using the date picker on Date fields (Instant fields default to the user's timezone). Please see the video and code comments for details.
📷 Screenshots & Recordings (optional)
Explaining the change (turn sound on):
2025-11-12_19-33-19.mp4