diff --git a/CHANGES.md b/CHANGES.md index 01dfed6c2d5d..7bd8187a69fb 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -10,6 +10,7 @@ Change Log * Fix issue where extruded `PolygonGeometry` was always extruding to the ellipsoid surface instead of specified height. * Fix an issue where non-feature nodes prevented KML documents from loading. [#2945](https://github.com/AnalyticalGraphicsInc/cesium/pull/2945). * Removed [es5-shim](https://github.com/kriskowal/es5-shim), which is no longer required by the unit tests. [#2933](https://github.com/AnalyticalGraphicsInc/cesium/pull/2945) +* Fix issue where `JulianDate` would not parse certain dates properly. [#405](https://github.com/AnalyticalGraphicsInc/cesium/issues/405) ### 1.12 - 2015-08-03 diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 26d7ccecf307..7939720f1920 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -61,6 +61,6 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu * [Aditya Raisinghani](https://github.com/adi2412) * [Ilia Choly](https://github.com/icholy) * [Farouk Abdou](https://github.com/kaktus40) -* [StÈphane Lozier](https://github.com/slozier) +* [Stéphane Lozier](https://github.com/slozier) Also see [our contributors page](http://cesiumjs.org/contributors.html) for more information. diff --git a/Source/Core/JulianDate.js b/Source/Core/JulianDate.js index 4f0759580026..390ff91b975f 100644 --- a/Source/Core/JulianDate.js +++ b/Source/Core/JulianDate.js @@ -122,7 +122,7 @@ define([ var a = ((month - 14) / 12) | 0; var b = year + 4800 + a; - var dayNumber = (((1461 * b) / 4) | 0) + (((367 * (month - 2 - 12 * a)) / 12) | 0) - (((3 * ((b + 100) / 100)) / 4) | 0) + day - 32075; + var dayNumber = (((1461 * b) / 4) | 0) + (((367 * (month - 2 - 12 * a)) / 12) | 0) - (((3 * (((b + 100) / 100) | 0)) / 4) | 0) + day - 32075; // JulianDates are noon-based hour = hour - 12; diff --git a/Specs/Core/JulianDateSpec.js b/Specs/Core/JulianDateSpec.js index 4fb6a2ad6cdb..933b3485ec50 100644 --- a/Specs/Core/JulianDateSpec.js +++ b/Specs/Core/JulianDateSpec.js @@ -146,6 +146,13 @@ defineSuite([ expect(julianDate.secondsOfDay).toEqual(34); }); + it('Construct a date from a JavaScript Date (5)', function() { + var jsDate = new Date('11/17/2039 12:00:00 AM UTC'); + var julianDate = JulianDate.fromDate(jsDate); + expect(julianDate.dayNumber).toEqual(2466109); + expect(julianDate.secondsOfDay).toEqual(43236); + }); + it('Fail to construct from an undefined JavaScript Date', function() { expect(function() { return JulianDate.fromDate(undefined);