Skip to content

Commit a8c8998

Browse files
committed
fix: fix toUnixTimestamp when converting Date objects
1 parent be5654b commit a8c8998

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/volume.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -465,15 +465,15 @@ export function toUnixTimestamp(time) {
465465
if(typeof time === 'string' && (+time == (time as any))) {
466466
return +time;
467467
}
468+
if(time instanceof Date) {
469+
return time.getTime() / 1000;
470+
}
468471
if(isFinite(time)) {
469472
if (time < 0) {
470473
return Date.now() / 1000;
471474
}
472475
return time;
473476
}
474-
if(time instanceof Date) {
475-
return time.getTime() / 1000;
476-
}
477477
throw new Error('Cannot parse time: ' + time);
478478
}
479479

0 commit comments

Comments
 (0)