Closed Bug 449921 Opened 16 years ago Closed 7 months ago

support new Date("01JAN2008")

Categories

(Core :: JavaScript: Standard Library, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
120 Branch
Tracking Status
firefox120 --- fixed

People

(Reporter: BijuMailList, Assigned: vinny.diehl)

References

(Blocks 1 open bug, )

Details

(Keywords: dev-doc-complete, parity-chrome)

Attachments

(1 file)

One of the page on our intranet which works in IE wont work in Firefox.
I raised the issue but they replied they dont support Firefox on intranet.
And insist I only use IE6.

Upon investigating I found the reason for the issue.
For "new Date(strDate)" we support formats

"1 JAN2008", "2008 JAN1", "1,JAN2008", "2008,JAN1", 
"JAN1 2008", "JAN2008 1", "JAN1,2008", "JAN2008,1"

But not "1JAN2008" and "2008JAN1" or "01JAN2008" and "2008JAN01" 
And "01JAN2008" is a common format used while doing international shipping.
Which come thru EDI file
IE support this format but not Firefox.

So can we also support new Date("01JAN2008")?

PS: 
* I wish there is also support for all ISO date formats.
* http://groups.google.com/group/mozilla.dev.tech.js-engine/browse_thread/thread/1737443c42085a52
Summary: [RFE] support new Date("01JAN2008") → support new Date("01JAN2008")
Assignee: general → nobody
Blocks: 1274354
Component: JavaScript Engine → JavaScript: Standard Library
Severity: normal → S3

It seems that in general, alphanumeric/symbolic elements of the string can run up against numeric elements with no whitespace and no problems, however if a number directly precedes an alphabetical char or most symbols, it returns NaN. I have a patch that relaxes this requirement and doesn't break anything that we have tested for.

Fixing this will also fix Bug 485639.

Assignee: nobody → vinny.diehl
Status: NEW → ASSIGNED
Keywords: parity-chrome
See Also: → 485639

More specifically, numbers can now run up against the next parsed
element with no problems, so things like "Aug.15.2015" now work as well.
In adding a test for this case, I noticed that the tests for parsing
periods were broken and could not fail the way that they were written,
so I fixed them.

fixes Bug 485639 - for cases like "Aug 15 2015 10:00am"

Attachment #9348649 - Attachment description: Bug 449921 - Support Dates with numbers directly preceding alpha chars r?#spidermonkey-reviewers → Bug 449921 - Support Dates with numbers directly preceding alpha chars r?arai
Attachment #9348649 - Attachment description: Bug 449921 - Support Dates with numbers directly preceding alpha chars r?arai → Bug 449921 - Loosen requirements for characters directly following numbers r?arai
See Also: → 1760290
Duplicate of this bug: 1760290
Duplicate of this bug: 485639
Pushed by arai_a@mac.com:
https://hg.mozilla.org/integration/autoland/rev/d495f0f008a3
Loosen requirements for characters directly following numbers r=arai

Backed out for causing xpcshell failures on test_natural-sort.js.

[task 2023-09-13T09:25:44.967Z] 09:25:44     INFO -  TEST-START | devtools/shared/tests/xpcshell/test_natural-sort.js
[task 2023-09-13T09:25:45.331Z] 09:25:45  WARNING -  TEST-UNEXPECTED-FAIL | devtools/shared/tests/xpcshell/test_natural-sort.js | xpcshell return code: 0
[task 2023-09-13T09:25:45.331Z] 09:25:45     INFO -  TEST-INFO took 360ms
[task 2023-09-13T09:25:45.331Z] 09:25:45     INFO -  >>>>>>>
[task 2023-09-13T09:25:45.331Z] 09:25:45     INFO -  (xpcshell/head.js) | test MAIN run_test pending (1)
[task 2023-09-13T09:25:45.331Z] 09:25:45     INFO -  "different values types"
[task 2023-09-13T09:25:45.331Z] 09:25:45     INFO -  TEST-PASS | devtools/shared/tests/xpcshell/test_natural-sort.js | compareOptions - [compareOptions : 909] number always comes first - true == true
[task 2023-09-13T09:25:45.331Z] 09:25:45     INFO -  TEST-PASS | devtools/shared/tests/xpcshell/test_natural-sort.js | compareOptions - [compareOptions : 909] number vs numeric string - should remain unchanged (error in chrome) - true == true
[task 2023-09-13T09:25:45.331Z] 09:25:45     INFO -  TEST-PASS | devtools/shared/tests/xpcshell/test_natural-sort.js | compareOptions - [compareOptions : 909] padding numeric string vs number - true == true
[task 2023-09-13T09:25:45.331Z] 09:25:45     INFO -  "datetime"
[task 2023-09-13T09:25:45.331Z] 09:25:45     INFO -  TEST-PASS | devtools/shared/tests/xpcshell/test_natural-sort.js | compareOptions - [compareOptions : 909] similar dates - true == true
[task 2023-09-13T09:25:45.331Z] 09:25:45     INFO -  TEST-PASS | devtools/shared/tests/xpcshell/test_natural-sort.js | compareOptions - [compareOptions : 909] similar dates - true == true
[task 2023-09-13T09:25:45.331Z] 09:25:45     INFO -  TEST-PASS | devtools/shared/tests/xpcshell/test_natural-sort.js | compareOptions - [compareOptions : 909] javascript toString(), different timezones - true == true
[task 2023-09-13T09:25:45.331Z] 09:25:45     INFO -  TEST-PASS | devtools/shared/tests/xpcshell/test_natural-sort.js | compareOptions - [compareOptions : 909] Date.toString(), Date.toLocaleString() - true == true
[task 2023-09-13T09:25:45.331Z] 09:25:45     INFO -  TEST-PASS | devtools/shared/tests/xpcshell/test_natural-sort.js | compareOptions - [compareOptions : 909] Date.toUTCString() - true == true
[task 2023-09-13T09:25:45.332Z] 09:25:45     INFO -  TEST-PASS | devtools/shared/tests/xpcshell/test_natural-sort.js | compareOptions - [compareOptions : 909] true == true
[task 2023-09-13T09:25:45.332Z] 09:25:45     INFO -  TEST-PASS | devtools/shared/tests/xpcshell/test_natural-sort.js | compareOptions - [compareOptions : 909] true == true
[task 2023-09-13T09:25:45.332Z] 09:25:45     INFO -  TEST-PASS | devtools/shared/tests/xpcshell/test_natural-sort.js | compareOptions - [compareOptions : 909] true == true
[task 2023-09-13T09:25:45.332Z] 09:25:45     INFO -  TEST-PASS | devtools/shared/tests/xpcshell/test_natural-sort.js | compareOptions - [compareOptions : 909] ISO8601 Dates - true == true
[task 2023-09-13T09:25:45.332Z] 09:25:45     INFO -  TEST-PASS | devtools/shared/tests/xpcshell/test_natural-sort.js | compareOptions - [compareOptions : 909] ISO8601-ish YYYY-MM-DDThh:mm:ss - which does not parse into a Date instance - true == true
[task 2023-09-13T09:25:45.332Z] 09:25:45     INFO -  TEST-PASS | devtools/shared/tests/xpcshell/test_natural-sort.js | compareOptions - [compareOptions : 909] RFC1123 testing different timezones - true == true
[task 2023-09-13T09:25:45.333Z] 09:25:45     INFO -  TEST-PASS | devtools/shared/tests/xpcshell/test_natural-sort.js | compareOptions - [compareOptions : 909] unix epoch, Date.getTime() - true == true
[task 2023-09-13T09:25:45.333Z] 09:25:45     INFO -  TEST-PASS | devtools/shared/tests/xpcshell/test_natural-sort.js | compareOptions - [compareOptions : 909] mixed Date types - true == true
[task 2023-09-13T09:25:45.334Z] 09:25:45     INFO -  TEST-PASS | devtools/shared/tests/xpcshell/test_natural-sort.js | compareOptions - [compareOptions : 909] "Session" amongst date strings - true == true
[task 2023-09-13T09:25:45.335Z] 09:25:45     INFO -  TEST-PASS | devtools/shared/tests/xpcshell/test_natural-sort.js | compareOptions - [compareOptions : 909] "Session" amongst date strings (complex) - true == true
[task 2023-09-13T09:25:45.335Z] 09:25:45     INFO -  TEST-PASS | devtools/shared/tests/xpcshell/test_natural-sort.js | compareOptions - [compareOptions : 909] "Session" amongst strings - true == true
[task 2023-09-13T09:25:45.335Z] 09:25:45     INFO -  "version number strings"
[task 2023-09-13T09:25:45.336Z] 09:25:45     INFO -  TEST-PASS | devtools/shared/tests/xpcshell/test_natural-sort.js | compareOptions - [compareOptions : 909] close version numbers - true == true
[task 2023-09-13T09:25:45.336Z] 09:25:45  WARNING -  TEST-UNEXPECTED-FAIL | devtools/shared/tests/xpcshell/test_natural-sort.js | compareOptions - [compareOptions : 900] more version numbers
[task 2023-09-13T09:25:45.337Z] 09:25:45     INFO -  Element 0 does not match:
[task 2023-09-13T09:25:45.337Z] 09:25:45     INFO -  [0] 1.1.100
[task 2023-09-13T09:25:45.337Z] 09:25:45     INFO -  [0] 1.1.1 - false == true
[task 2023-09-13T09:25:45.338Z] 09:25:45     INFO -  /builds/worker/workspace/build/tests/xpcshell/tests/devtools/shared/tests/xpcshell/test_natural-sort.js:compareOptions:900
[task 2023-09-13T09:25:45.338Z] 09:25:45     INFO -  /builds/worker/workspace/build/tests/xpcshell/tests/devtools/shared/tests/xpcshell/test_natural-sort.js:runTest:891
[task 2023-09-13T09:25:45.338Z] 09:25:45     INFO -  /builds/worker/workspace/build/tests/xpcshell/tests/devtools/shared/tests/xpcshell/test_natural-sort.js:run_test/<:230
[task 2023-09-13T09:25:45.339Z] 09:25:45     INFO -  /builds/worker/workspace/build/tests/xpcshell/tests/devtools/shared/tests/xpcshell/test_natural-sort.js:test:875
[task 2023-09-13T09:25:45.339Z] 09:25:45     INFO -  /builds/worker/workspace/build/tests/xpcshell/tests/devtools/shared/tests/xpcshell/test_natural-sort.js:run_test:224
[task 2023-09-13T09:25:45.339Z] 09:25:45     INFO -  /builds/worker/workspace/build/tests/xpcshell/head.js:_execute_test:586
[task 2023-09-13T09:25:45.340Z] 09:25:45     INFO -  -e:null:1
[task 2023-09-13T09:25:45.340Z] 09:25:45     INFO -  exiting test
[task 2023-09-13T09:25:45.340Z] 09:25:45     INFO -  <<<<<<<
[task 2023-09-13T09:25:45.343Z] 09:25:45     INFO -  TEST-START | toolkit/mozapps/update/tests/unit_aus_update/updateSyncManager.js
Flags: needinfo?(vinny.diehl)

Looks like this tripped up naturalSort() here because patterns such as 1.1.1 are now parsed as dates. I'll have a patch up once I make sure no other xpcshell tests are busted.

Flags: needinfo?(vinny.diehl)
Pushed by arai_a@mac.com:
https://hg.mozilla.org/integration/autoland/rev/3e94aeff4142
Loosen requirements for characters directly following numbers r=arai,devtools-reviewers,nchevobbe
Status: ASSIGNED → RESOLVED
Closed: 7 months ago
Resolution: --- → FIXED
Target Milestone: --- → 120 Branch
Keywords: dev-doc-needed

hi y'all :) this PR exists to add the outcome of this bug to MDN's FX120 release notes:
https://github.com/mdn/content/pull/29861

tyvm!

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: