Comparing version 0.8.1 to 0.8.2
@@ -501,4 +501,4 @@ | ||
// set time given timezone relative to the currently set local time | ||
// (changing the internal "time" milliseconds value) | ||
d.setTimezone(timezone, true); | ||
// (changing the internal "time" milliseconds value unless ms specified) | ||
d.setTimezone(timezone, !(argc == 1 && typeof year === 'number')); | ||
} | ||
@@ -505,0 +505,0 @@ return d; |
@@ -5,3 +5,3 @@ { | ||
"keywords": ["date", "time", "time.h", "timezone", "setTimezone", "getTimezone"], | ||
"version": "0.8.1", | ||
"version": "0.8.2", | ||
"repository": { | ||
@@ -8,0 +8,0 @@ "type": "git", |
@@ -6,2 +6,37 @@ var should = require('should') | ||
describe('constructor', function() { | ||
it('should parse strings relative to TZ', function() { | ||
var d = new time.Date('2012-1-12 02:00 PM', 'America/New_York') | ||
d.getTime().should.equal(1326394800000); | ||
d.getTimezone().should.equal('America/New_York'); | ||
d = new time.Date('2012-1-12 02:00 PM', 'America/Los_Angeles') | ||
d.getTime().should.equal(1326405600000); | ||
d.getTimezone().should.equal('America/Los_Angeles'); | ||
}) | ||
it('should interpret date parts relative to TZ', function() { | ||
var d = new time.Date(2012, 0, 12, 14, 'America/New_York') | ||
d.getTime().should.equal(1326394800000); | ||
d.getTimezone().should.equal('America/New_York'); | ||
var d = new time.Date(2012, 0, 12, 14, 'America/Los_Angeles') | ||
d.getTime().should.equal(1326405600000); | ||
d.getTimezone().should.equal('America/Los_Angeles'); | ||
}) | ||
it('should accept milliseconds regardless of TZ', function() { | ||
var d1 = new time.Date(1352005200000, 'America/New_York'); | ||
var d2 = new time.Date(1352005200000, 'America/Los_Angeles'); | ||
d1.getTime().should.equal(d2.getTime()); | ||
d1.getTimezone().should.equal('America/New_York'); | ||
d2.getTimezone().should.equal('America/Los_Angeles'); | ||
}) | ||
}) | ||
describe('#setTimezone()', function () { | ||
@@ -8,0 +43,0 @@ |
Sorry, the diff of this file is not supported yet
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
40398
698