Opened 14 years ago
Last modified 6 years ago
#16495 new defect (bug)
Make iso8601_to_datetime a bit more compliant
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.0.5 |
Component: | Formatting | Keywords: | needs-patch needs-refresh needs-testing |
Focuses: | Cc: |
Description
With a valid ISO 8601 date string with dashes in the date or decimal fractions for seconds, this function will fail to parse it correctly. The attached patch updates the regex to optionally accept dashes and decimal fractions for seconds (which are ignored). It also uses a variable for the regex since it was duplicated.
Attachments (2)
Change History (8)
#3
@
12 years ago
Whoa, the hell is this function? Here's my take from the REST API, which handles RFC3339 (a subset of ISO8601 that doesn't include all the unnecessary bits) which is usually used on the 'net. I'd be happy to build off that, but this giant regex seems unnecessary.
#4
@
11 years ago
- Keywords needs-patch 2nd-opinion added; has-patch needs-unit-tests removed
Added a test function that lists several valid iso8601 dates and the mysql date they should be parsed to. Any patches submitted to this ticket will need to address these formats and pass the test (current implementation and existing patch don't quite meet that criteria).
This function doesn't handle 90% of the iso8601 formats it seems, for example, it chokes on something as basic as '2013-08-09T00:31:38Z' (even with the patch).
This needs serious unit tests and a patch that handles it as such.