Skip to content

Fix jquery-dateFormat parseTime dropping the time in colon-labelled timezones - #7883

Open
ankurjuneja wants to merge 1 commit into
release26.7-SNAPSHOTfrom
26.7_fb_instrumentScheduleDateTimeLocalFirefox
Open

Fix jquery-dateFormat parseTime dropping the time in colon-labelled timezones#7883
ankurjuneja wants to merge 1 commit into
release26.7-SNAPSHOTfrom
26.7_fb_instrumentScheduleDateTimeLocalFirefox

Conversation

@ankurjuneja

@ankurjuneja ankurjuneja commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Rationale

DateFormat.format.date(, …) builds its time from value.toTimeString() (e.g. "00:00:00 GMT-1000 (GMT-10:00)") and parseTime splits that whole string on :. It only accepts exactly 3 parts, so any timezone whose label contains a colon — Honolulu's (GMT-10:00), India's +05:30, etc. — yields 4+ parts, fails the check, and returns an empty time that pads to 00:00. Result: every Date formatted through this library shows midnight for affected users (calendar labels, tooltips, and anywhere DateFormat.format.date is used).

Fix: strip the trailing timezone label before splitting on : (time.replace(/\s.+/, '').split(':')) — the same strip the function already does at line 82, just applied before the length check instead of after. One-token change, applied to both jquery-dateFormat.js and jquery-dateFormat.min.js (the min file is served in production per jQuery.lib.xml, compileInProductionMode="false"). Non-affected timezones and the ISO/seconds parse paths are unchanged.

Related Pull Requests

Changes

@labkey-jeckels labkey-jeckels left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Request for a quick unit test for this change:

platform/core already has a jest harness (core/jest.config.js, jsdom, testRegex '(.(test)).(ts|tsx)$'), so a regression test is cheap: load jquery-dateFormat.js and assert that a Date stub whose toTimeString() returns 08:00:00 GMT-1000 (GMT-10:00) formats to 08:00, not 00:00.

@@ -1,2 +1,2 @@
/*! jquery-dateFormat 18-05-2015 */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please add a note to both files to say they've been patched.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants