Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RangeError: Invalid time value. Version 2.3.1 #42

Open
yinhuanyi opened this issue Mar 10, 2022 · 1 comment
Open

RangeError: Invalid time value. Version 2.3.1 #42

yinhuanyi opened this issue Mar 10, 2022 · 1 comment

Comments

@yinhuanyi
Copy link

when I build vuepress,error occured.
error vuepress-plugin-sitemap apply generated failed.
RangeError: Invalid time value
at Date.toISOString ()
at dateFormatter (/Users/Robby/Yinhuanyi_Project/WebStorm/vuepress-blog/node_modules/vuepress-plugin-sitemap/index.js:24:60)
at /Users/Robby/Yinhuanyi_Project/WebStorm/vuepress-blog/node_modules/vuepress-plugin-sitemap/index.js:69:13
at Array.forEach ()
at generated (/Users/Robby/Yinhuanyi_Project/WebStorm/vuepress-blog/node_modules/vuepress-plugin-sitemap/index.js:56:13)
at AsyncOption.asyncApply (/Users/Robby/Yinhuanyi_Project/WebStorm/vuepress-blog/node_modules/@vuepress/core/lib/node/plugin-api/abstract/AsyncOption.js:33:21)
at PluginAPI.applyAsyncOption (/Users/Robby/Yinhuanyi_Project/WebStorm/vuepress-blog/node_modules/@vuepress/core/lib/node/plugi

@anisabboud
Copy link

To fix this bug, need to change line 69 from page.lastUpdated -> page.lastUpdatedTimestamp.

const lastmodISO = page.lastUpdated
? dateFormatter(page.lastUpdated)
: undefined

Explanation

    lastUpdated: '21.5.2023, 23:13:40',  // Cannot be parsed by new Date(...) -> Invalid time value error
    lastUpdatedTimestamp: 1684700020000  // Can be parsed new Date(...) ✓

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants