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

Permalinks generation unable to parse other date formats #2880

Open
1 task done
re-xyr opened this issue Jun 24, 2021 · 0 comments · May be fixed by #2881
Open
1 task done

Permalinks generation unable to parse other date formats #2880

re-xyr opened this issue Jun 24, 2021 · 0 comments · May be fixed by #2881

Comments

@re-xyr
Copy link

re-xyr commented Jun 24, 2021

  • I confirm that this is an issue rather than a question.

Bug report

Current permalink generation from date frontmatter field is using a simple split on - characters. When using other formats of date (that is able to be parsed by Date), the permalink fails to generate. I noticed that this change was due to a flaw in the Date API (#2181). If so, please use a date library (e.g. dayjs) instead of rolling an error-prone parser.

The same problem is present in vuepress-next.

Steps to reproduce

Put this in a file:

---
date: Thu May 06 2021 18:10:16 GMT+0800 (中国标准时间)
permalink: /:year/:month/:day/:slug
---

What is expected?

Page is at /2021/05/06/....

What is actually happening?

Page is at /NaN/NaN/NaN/....

Other relevant information

  • Output of npx vuepress info in my VuePress project:
Environment Info:

  System:
    OS: macOS 10.15.7
    CPU: (8) x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
  Binaries:
    Node: 14.15.5 - /usr/local/bin/node
    Yarn: 1.13.0 - /usr/local/bin/yarn
    npm: 7.13.0 - /usr/local/bin/npm
  Browsers:
    Chrome: 93.0.4549.4
    Edge: Not Found
    Firefox: 62.0.3
    Safari: 14.0.3
  npmPackages:
    @vuepress/core:  1.8.2 
    @vuepress/theme-default:  1.8.2 
    vuepress: ^1.8.2 => 1.8.2 
  npmGlobalPackages:
    vuepress: Not Found
@re-xyr re-xyr linked a pull request Jun 24, 2021 that will close this issue
18 tasks
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

Successfully merging a pull request may close this issue.

1 participant