Skip to content

OBPIH-7569 java.util.Date fields should default to server timezone when using g:datePicker#5617

Merged
alannadolny merged 1 commit intorelease/0.9.6from
bug/OBPIH-7569-grails-datepicker-default-date-tz
Nov 13, 2025
Merged

OBPIH-7569 java.util.Date fields should default to server timezone when using g:datePicker#5617
alannadolny merged 1 commit intorelease/0.9.6from
bug/OBPIH-7569-grails-datepicker-default-date-tz

Conversation

@ewaterman
Copy link
Member

✨ 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

@github-actions github-actions bot added type: bug Addresses unintended behaviours of the app domain: frontend Changes or discussions relating to the frontend UI labels Nov 12, 2025
@codecov
Copy link

codecov bot commented Nov 12, 2025

Codecov Report

❌ Patch coverage is 0% with 5 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (release/0.9.6@8a309a6). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...p/taglib/org/pih/warehouse/DatePickerTagLib.groovy 0.00% 5 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

fieldType="${Date}"
precision="minute"
relativeYears="[-20..0]"
noSelection="['':'']"/>
Copy link
Member Author

@ewaterman ewaterman Nov 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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))
}
Copy link
Member Author

@ewaterman ewaterman Nov 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realized I could remove the check on attrs.value == null by moving this into a case in the switch block above

@SebastianLib
Copy link
Collaborator

Awesome work! Once again, thanks for helping me with this ticket!

@alannadolny alannadolny merged commit 6822c36 into release/0.9.6 Nov 13, 2025
7 checks passed
@alannadolny alannadolny deleted the bug/OBPIH-7569-grails-datepicker-default-date-tz branch November 13, 2025 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: frontend Changes or discussions relating to the frontend UI type: bug Addresses unintended behaviours of the app

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants