seems a bit much...
Opened this issue · 1 comments
tracker1 commented
function date2obj(value) {
var parts = ((value || value === 0) ? new Date(value) : new Date()).toJSON().split(/\D/);
return {
year: parts.shift(),
month: parts.shift(),
day: parts.shift(),
hour: parts.shift(),
minute: parts.shift(),
second: parts.shift(),
millisecond: parts.shift()
}
}
of ...
function date2obj(value) {
const [year, month, day, hour, minute, second, millisecond] =
((value || value === 0) ? new Date(value) : new Date()).toJSON().split(/\D/);
return {year, month, day, hour, minute, second, millisecond};
}
tigercosmos commented
cool! I like this.