FIO-8477: Fix the timezones issue in formatDate function #114
+40
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Link to Jira Ticket
https://formio.atlassian.net/browse/FIO-8477
Description
This PR addresses issues encountered with the
formatDate
function, originally implemented in the formio.js library, which utilizes the moment-timezone library for timezone formatting. Specifically, thez
format option in moment-timezone, used for abbreviated timezone names, does not directly translate to the dayjs library we currently employ. To bridge this functionality gap, the advancedFormat plugin from dayjs is necessary. However, a known issue with dayjs (#1154) results in the generation ofGMT+..
formats instead of abbreviated timezone names. Notably, thezzz
format option in dayjs correctly provides the full timezone name.During the process of integrating the advancedFormat plugin and updating the
formatDate
function, I also discovered and addressed a separate issue related to UTC formatting. Previously, theformatDate
function incorrectly used the current date for UTC conversions instead of the provided date value.How has this PR been tested?
Unit testing
Checklist: