Skip to content

Commit 987de3d

Browse files
committed
fix: correct timestamp default
1 parent e1d1a2f commit 987de3d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/utils/download.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@ export function getFileNameWithFormat(format: string, ext: string, {
2525
title = document.title,
2626
// chatId will be empty when exporting all conversations
2727
chatId = '',
28-
createTime = Date.now(),
29-
updateTime = Date.now(),
28+
// convert to seconds for unixTimestampToISOString which expects a unix
29+
// timestamp (in seconds). using Date.now() directly would pass
30+
// milliseconds which results in an invalid far future date.
31+
createTime = Math.floor(Date.now() / 1000),
32+
updateTime = Math.floor(Date.now() / 1000),
3033
} = {}) {
3134
const _title = sanitize(title).replace(/\s+/g, '_')
3235
const _createTime = unixTimestampToISOString(createTime)

0 commit comments

Comments
 (0)