Skip to content

Commit

Permalink
Resolve issue #405
Browse files Browse the repository at this point in the history
  • Loading branch information
slozier committed Aug 18, 2015
1 parent b69af04 commit 7ae6f9d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Source/Core/JulianDate.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 7 additions & 0 deletions Specs/Core/JulianDateSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7ae6f9d

Please sign in to comment.