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

Unable to define weekStartsOn parameter #4

Open
binarykitchen opened this issue Feb 24, 2022 · 1 comment · May be fixed by #7
Open

Unable to define weekStartsOn parameter #4

binarykitchen opened this issue Feb 24, 2022 · 1 comment · May be fixed by #7
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@binarykitchen
Copy link

binarykitchen commented Feb 24, 2022

Some countries might start the week on another day, which can be configured in date-fns weekStartsOn parameter.

Unfortunately, this cannot be passed over here due to fixed lexing:

res = dateFns[cmd](res, ...args)

Can we figure a way, a solution, how to support such a parameter?

@derhuerst derhuerst added enhancement New feature or request help wanted Extra attention is needed labels Mar 15, 2022
@derhuerst
Copy link
Owner

Huh, this is a tricky problem.

Without trying it out, I think the best way is to

  1. add an optional opt = {} to createParse
  2. const {weekStartsOn} = {weekStartsOn: 0, ...opt}
  3. if cmd is a date-fns command where the weekStartsOn option is accepted, pass it into args via args = [...args, {weekStartsOn}].

PR welcome!

@binarykitchen binarykitchen linked a pull request Apr 12, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants