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

Adds support for weekStartsOn and prettier config #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

binarykitchen
Copy link

@binarykitchen binarykitchen commented Apr 12, 2022

fixes #4

Copy link
Owner

@derhuerst derhuerst left a 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()) => {
Copy link
Owner

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}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
opts = {weekStartsOn: 0}
opts = {}

str,
now = new Date(),
opts = {weekStartsOn: 0}
) => {
const instructions = lex(str)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const instructions = lex(str)
const {
weekStartsOn,
} = {
weekStartsOn: 0,
...opt,
}
const instructions = lex(str)

@derhuerst
Copy link
Owner

Also, would you mind adding a test case? Thanks!

@derhuerst
Copy link
Owner

@binarykitchen Ping, in case you want to clean this up a bit. 🙂 I'd be happy to merge it afterwards!

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 this pull request may close these issues.

Unable to define weekStartsOn parameter
2 participants