mirror of
https://github.com/samsonjs/strftime.git
synced 2026-03-25 09:05:48 +00:00
Fix for #39 (Bug when specify partial hour timezone)
Changed calculation of timezone offset in minutes Added round and abs for partial hour
This commit is contained in:
parent
eedbb8b701
commit
dfeb3f8e97
1 changed files with 2 additions and 2 deletions
|
|
@ -103,7 +103,7 @@
|
|||
var sign = tz[0] == '-' ? -1 : 1;
|
||||
var hours = parseInt(tz.slice(1, 3), 10);
|
||||
var mins = parseInt(tz.slice(3, 5), 10);
|
||||
tz = sign * (60 * hours) + mins;
|
||||
tz = sign * ((60 * hours) + mins);
|
||||
}
|
||||
|
||||
if (tzType) {
|
||||
|
|
@ -271,7 +271,7 @@
|
|||
}
|
||||
else {
|
||||
var off = typeof tz == 'number' ? tz : -d.getTimezoneOffset();
|
||||
return (off < 0 ? '-' : '+') + pad(Math.abs(off / 60)) + pad(off % 60);
|
||||
return (off < 0 ? '-' : '+') + pad(Math.floor(Math.abs(off) / 60)) + pad(Math.abs(off) % 60);
|
||||
}
|
||||
|
||||
default: return c;
|
||||
|
|
|
|||
Loading…
Reference in a new issue