chronoshift
Advanced tools
Comparing version 0.3.3 to 0.3.4
@@ -75,3 +75,6 @@ /// <reference path="../typings/immutable-class.d.ts" /> | ||
ceil: function (dt, tz) { | ||
return move(floor(dt, tz), tz, 1); | ||
var floored = floor(dt, tz); | ||
if (floored.valueOf() === dt.valueOf()) | ||
return dt; // Just like ceil(3) is 3 and not 4 | ||
return move(floored, tz, 1); | ||
} | ||
@@ -78,0 +81,0 @@ }; |
{ | ||
"name": "chronoshift", | ||
"version": "0.3.3", | ||
"version": "0.3.4", | ||
"description": "A tiny library for shifting time with timezones", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -27,3 +27,5 @@ module Chronoshift { | ||
ceil: (dt: Date, tz: Timezone) => { | ||
return move(floor(dt, tz), tz, 1); | ||
var floored = floor(dt, tz); | ||
if (floored.valueOf() === dt.valueOf()) return dt; // Just like ceil(3) is 3 and not 4 | ||
return move(floored, tz, 1); | ||
} | ||
@@ -30,0 +32,0 @@ }; |
@@ -65,2 +65,10 @@ /// <reference path="../typings/mocha/mocha.d.ts" /> | ||
}); | ||
it("ceils day", function () { | ||
var d1 = new Date("2014-12-11T22:11:57.469Z"); | ||
var d2 = new Date("2014-12-12T00:00:00.000Z"); | ||
expect(chronoshift.day.ceil(d1, tz)).to.eql(d2); | ||
d1 = new Date("2014-12-08T00:00:00.000Z"); | ||
d2 = new Date("2014-12-08T00:00:00.000Z"); | ||
expect(chronoshift.day.ceil(d1, tz)).to.eql(d2); | ||
}); | ||
it("moves week", function () { | ||
@@ -67,0 +75,0 @@ var dates = [ |
@@ -83,2 +83,12 @@ /// <reference path="../typings/mocha/mocha.d.ts" /> | ||
it("ceils day", () => { | ||
var d1 = new Date("2014-12-11T22:11:57.469Z"); | ||
var d2 = new Date("2014-12-12T00:00:00.000Z"); | ||
expect(chronoshift.day.ceil(d1, tz)).to.eql(d2); | ||
d1 = new Date("2014-12-08T00:00:00.000Z"); | ||
d2 = new Date("2014-12-08T00:00:00.000Z"); | ||
expect(chronoshift.day.ceil(d1, tz)).to.eql(d2); | ||
}); | ||
it("moves week", () => { | ||
@@ -85,0 +95,0 @@ var dates: Date[] = [ |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
801608
7824
43