You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When I use the weekday plugin to find the previous instance of a day of the week, for example the last Sunday, it goes back two weeks instead of one. For example the documentation for the weekday plugin shows this example:
dayjs().weekday(-7);// last Sunday
which seems to indicate this would return the most recent Sunday. However the behavior I actually get is it returns the date of the Sunday before last.
Expected behavior
Here is a reproduction of the problem in the Node.js REPL.
As you can see, the current date when I ran this was 2021-01-14. I expected weekday(-7) to return the previous Sunday, 2021-01-10, but instead it returned 2021-01-03, which is the Sunday before the previous Sunday.
Information
Day.js Version: v1.9.3
OS: MacOS 10.15.7
Browser: Node.js 12.5.0
Time zone: GMT-05:00 EST
The text was updated successfully, but these errors were encountered:
ajenkinski
changed the title
weekday(-dayOfWeek) goes back two weeks instead of 1
weekday(-dayOfWeek) goes back two weeks instead of 1
Jan 14, 2021
Describe the bug
When I use the weekday plugin to find the previous instance of a day of the week, for example the last Sunday, it goes back two weeks instead of one. For example the documentation for the weekday plugin shows this example:
which seems to indicate this would return the most recent Sunday. However the behavior I actually get is it returns the date of the Sunday before last.
Expected behavior
Here is a reproduction of the problem in the Node.js REPL.
As you can see, the current date when I ran this was 2021-01-14. I expected
weekday(-7)
to return the previous Sunday, 2021-01-10, but instead it returned 2021-01-03, which is the Sunday before the previous Sunday.Information
The text was updated successfully, but these errors were encountered: