Compare commits
6 Commits
master
...
ivan-truso
Author | SHA1 | Date | |
---|---|---|---|
|
b1c5037ca8 | ||
|
51d05ad8a0 | ||
|
db81ca6594 | ||
|
64e8998e59 | ||
|
1dfabe74b1 | ||
|
c14e1712ea |
25
xlsx.js
generated
25
xlsx.js
generated
@ -3213,22 +3213,21 @@ function evert_arr(obj) {
|
||||
return o;
|
||||
}
|
||||
|
||||
var basedate = new Date(1899, 11, 30, 0, 0, 0); // 2209161600000
|
||||
var base1900 = Date.UTC(1899, 11, 30);
|
||||
var base1904 = Date.UTC(1904, 0, 1);
|
||||
|
||||
// According to https://docs.microsoft.com/ru-ru/archive/blogs/ericlippert/erics-complete-guide-to-vt_date
|
||||
// we must treat OLE Automation Date as it has no timezone at all.
|
||||
// So to avoid any possible TZ/DST issues do calculations in UTC
|
||||
function datenum(v, date1904) {
|
||||
var epoch = v.getTime();
|
||||
if(date1904) epoch -= 1462*24*60*60*1000;
|
||||
var dnthresh = basedate.getTime() + (v.getTimezoneOffset() - basedate.getTimezoneOffset()) * 60000;
|
||||
return (epoch - dnthresh) / (24 * 60 * 60 * 1000);
|
||||
var start = date1904 ? base1904 : base1900;
|
||||
var vTime = Date.UTC(v.getFullYear(), v.getMonth(), v.getDate(), v.getHours(), v.getMinutes(), v.getSeconds(), v.getMilliseconds());
|
||||
return (vTime - start) / 86400000;
|
||||
}
|
||||
var refdate = new Date();
|
||||
var dnthresh = basedate.getTime() + (refdate.getTimezoneOffset() - basedate.getTimezoneOffset()) * 60000;
|
||||
var refoffset = refdate.getTimezoneOffset();
|
||||
function numdate(v) {
|
||||
var out = new Date();
|
||||
out.setTime(v * 24 * 60 * 60 * 1000 + dnthresh);
|
||||
if (out.getTimezoneOffset() !== refoffset) {
|
||||
out.setTime(out.getTime() + (out.getTimezoneOffset() - refoffset) * 60000);
|
||||
}
|
||||
var out = new Date(base1900 + v * 86400000);
|
||||
// De-adjust timezone offset
|
||||
out.setTime(out.getTime() + out.getTimezoneOffset() * 60000);
|
||||
return out;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user