mirror of
https://github.com/samsonjs/strftime.git
synced 2026-03-25 09:05:48 +00:00
Fix offset for format %z
This commit is contained in:
parent
7d4802425e
commit
397eb175cd
1 changed files with 6 additions and 2 deletions
|
|
@ -156,7 +156,7 @@
|
|||
var timestamp;
|
||||
|
||||
if (!date) {
|
||||
var currentTimestamp = Date.now();
|
||||
var currentTimestamp = Date.now(), origOff = 0;
|
||||
if (currentTimestamp > _cachedDateTimestamp) {
|
||||
_cachedDateTimestamp = currentTimestamp;
|
||||
_cachedDate = new Date(_cachedDateTimestamp);
|
||||
|
|
@ -168,11 +168,13 @@
|
|||
// we tied to getTimezoneOffset of the current date
|
||||
//_cachedDate = new Date(_cachedDateTimestamp + getTimestampToUtcOffsetFor(_cachedDate) + _customTimezoneOffset);
|
||||
} else {
|
||||
origOff = _cachedDate.getTimezoneOffset() * -60000;
|
||||
_cachedDate = new Date(_cachedDateTimestamp - getTimestampToUtcOffsetFor(_cachedDate) - _customTimezoneOffset);
|
||||
_customTimezoneOffset = origOff;
|
||||
}
|
||||
}
|
||||
else {
|
||||
timestamp = _cachedDateTimestamp;
|
||||
timestamp = _cachedDateTimestamp;
|
||||
}
|
||||
date = _cachedDate;
|
||||
}
|
||||
|
|
@ -182,7 +184,9 @@
|
|||
if (_useUtcBasedDate) {
|
||||
//date = new Date(date.getTime() + getTimestampToUtcOffsetFor(date) + _customTimezoneOffset);
|
||||
} else {
|
||||
origOff = date.getTimezoneOffset() * -60000;
|
||||
date = new Date(date.getTime() - getTimestampToUtcOffsetFor(date) - _customTimezoneOffset);
|
||||
_customTimezoneOffset = origOff;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue