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

previousMonday #2507

Closed
YesUnO opened this issue Jun 9, 2021 · 0 comments · Fixed by #2522
Closed

previousMonday #2507

YesUnO opened this issue Jun 9, 2021 · 0 comments · Fixed by #2522
Labels

Comments

@YesUnO
Copy link

YesUnO commented Jun 9, 2021

similiar to nextMonday. i ended up using soemthing from SO, because i didnt find this method in this library

import {
startOfMonth,
lastDayOfMonth,
nextSunday
isMonday
} from "date-fns";
...

function someFunction() {
...
var monthStart = startOfMonth(this.activeDate);
var prevMondayOfMonth = monthStart;

  if (!isMonday(monthStart)) prevMondayOfMonth.setDate(prevMondayOfMonth.getDate() - ((prevMondayOfMonth.getDay() + 6) % 7));

...
}

so i thought it might be usefull method in this library

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants