mirror of
https://github.com/scratchfoundation/scratch-html5.git
synced 2025-02-26 06:03:52 -05:00
Merge pull request #54 from prokls/master
SensingPrims.primTimestamp and Daylight Savings Time
This commit is contained in:
commit
62abf8d547
2 changed files with 2 additions and 2 deletions
|
@ -245,7 +245,7 @@ SensingPrims.prototype.primTimestamp = function(b) {
|
|||
var epoch = new Date(2000, 0, 1);
|
||||
var dst = now.getTimezoneOffset() - epoch.getTimezoneOffset();
|
||||
var msSince = now.getTime() - epoch.getTime();
|
||||
msSince += (now.getTimezoneOffset() - dst) * 60000;
|
||||
msSince -= dst * 60000;
|
||||
return msSince / 86400000;
|
||||
};
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ describe('SensingPrims', function() {
|
|||
});
|
||||
|
||||
it('should return the days since 2000', function() {
|
||||
expect(sensingPrims.prototype.primTimestamp()).toEqual(5280.25);
|
||||
expect(sensingPrims.prototype.primTimestamp()).toBeCloseTo(5280);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue