-
Notifications
You must be signed in to change notification settings - Fork 3
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
Adds support for weekStartsOn and prettier config #7
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, please revert the unrelated changes (adding Prettier & pinning the dependencies' versions).
Other than that, I just have some minor comments.
['endOfWeek', dt => dt.endOf('week')] | ||
]) | ||
|
||
const createParse = (DateTime) => { | ||
const createParse = DateTime => { | ||
const parseHumanRelativeTime = (str, now = DateTime.local()) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please give the Luxor parseHumanRelativeTime
variant the same signature as the date-fns variant, by adding opt = {}
.
const parseHumanRelativeTime = ( | ||
str, | ||
now = new Date(), | ||
opts = {weekStartsOn: 0} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
opts = {weekStartsOn: 0} | |
opts = {} |
str, | ||
now = new Date(), | ||
opts = {weekStartsOn: 0} | ||
) => { | ||
const instructions = lex(str) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const instructions = lex(str) | |
const { | |
weekStartsOn, | |
} = { | |
weekStartsOn: 0, | |
...opt, | |
} | |
const instructions = lex(str) |
Also, would you mind adding a test case? Thanks! |
@binarykitchen Ping, in case you want to clean this up a bit. 🙂 I'd be happy to merge it afterwards! |
fixes #4