Skip to content

JulianDate.createFromIso8601 has issues #1

@mramato

Description

@mramato

The current implementation of JulianDate.createFromIso8601 uses Date.parse which according to ECMAScript 5 supports ISO8601 dates. This has two major problems:

  1. ISO8601 supports fractional milliseconds but Date is only accurate to the millisecond, so any conversions with fractional milliseconds are rounded and less accurate.
  2. ISO8601 and JulianDate both support leap seconds, but Date does not; called Date.parse with a leap second generates an invalid date.

The solution is to simply re-implement createFromIso8601 ourselves, making sure we handle all valid date specifications. This eliminates the middle-man Date approach and maintains accuracy and leap seconds. I've added a test to Core/JulianDateSpec.js, "Construct a date from ISO8601 on a leap second.", which is currently ignored with xit that shows the problem.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions