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

dateString parsing does not match resume-schema definition "optional" parts #21

Closed
cometsong opened this issue Dec 5, 2023 · 1 comment
Labels
wontfix This will not be worked on

Comments

@cometsong
Copy link

Bug

Parsing of date format in resume-schema has all parts optional except only year required.

This is implemented as a "definition" in their repo's schema.json:

https://github.com/jsonresume/resume-schema/blob/master/schema.json#L5

Recreate

To recreate, remove the month and day from one of the "work" entries, run the resumed render, view the result showing "Jan"

@cometsong cometsong changed the title dateString parsing does not match resume-schema definition of "optional" parts dateString parsing does not match resume-schema definition "optional" parts Dec 5, 2023
@rbardini
Copy link
Owner

That's because the JavaScript Date object will default to the first day of the month or first month of the year, if they're not defined:

const dateA = new Date('2023')
dateA.getFullYear() // 2023
dateA.getMonth() // 0 (month is 0-indexed)
dateA.getDate() // 1

const dateB = new Date('2023-06')
dateB.getFullYear() // 2023
dateB.getMonth() // 5
dateB.getDate() // 1

Thus, my recommendation is to always define the month, even though a monthless date is valid according to the schema.

@rbardini rbardini closed this as not planned Won't fix, can't repro, duplicate, stale Dec 27, 2023
@rbardini rbardini added the wontfix This will not be worked on label Dec 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants