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

week function not working correctly #386

Open
ChrisSeakane opened this issue Apr 17, 2023 · 8 comments
Open

week function not working correctly #386

ChrisSeakane opened this issue Apr 17, 2023 · 8 comments

Comments

@ChrisSeakane
Copy link

Seems like 2022 starts already as week 2, and goes up to 53 and back down to 52 again

let d = spacetime('2022/01/01','utc');
d = d.every('day','2022/12/31');
d.forEach(function (e) {console.log(e.format('iso-short'),e.week())})

2022-01-01
2
2022-01-02
2
2022-01-03
3
2022-01-04
3
2022-01-05
3
2022-01-06
3
2022-01-07
3
2022-01-08
3
2022-01-09
3
2022-01-10
4
2022-01-11
4
2022-01-12
4
.
.
.
2022-12-10
51
2022-12-11
51
2022-12-12
52
2022-12-13
52
2022-12-14
52
2022-12-15
52
2022-12-16
52
2022-12-17
52
2022-12-18
52
2022-12-19
53
2022-12-20
53
2022-12-21
53
2022-12-22
53
2022-12-23
53
2022-12-24
53
2022-12-25
53
2022-12-26
52
2022-12-27
52
2022-12-28
52
2022-12-29
52
2022-12-30
52

spencermountain added a commit that referenced this issue Apr 19, 2023
@spencermountain
Copy link
Owner

Thanks chris. Yep, this looks like an issue. will check it out today
cheers

@spencermountain
Copy link
Owner

argh - gonna move this behind 8.0. Redoing this logic anyways. Let me know if it's a serious problem, and I can do a hotfix.
thanks

@ChrisSeakane
Copy link
Author

No worries. Take your time.

@DarshanDixit05
Copy link
Contributor

Hi 👋, I wanted to work on this issue . Can you please assign it to me?

@spencermountain
Copy link
Owner

it's all yours!
the issue is in here where the week-adding logic is scrambled-up. Feel free to change anything! It's pretty gross, as it is.
cheers

@DarshanDixit05
Copy link
Contributor

DarshanDixit05 commented May 7, 2023 via email

@spencermountain
Copy link
Owner

hi Darshan, you can clone the repo and run Chris's example from above.
I like to use the ./scratch.js file - i have it setup to hot-reload using npm run watch

  1. git clone
  2. npm install
  3. put chris's example in ./scratch.js
  4. npm run watch

@DarshanDixit05
Copy link
Contributor

Hey @spencermountain 👋,
The test case @ChrisSeakane mentioned is fixed. I think the logic written to check whether we're going to last year or not had some conditional check errors.

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

No branches or pull requests

3 participants