feat: recover nightwave challenges #2593

Merged
Sainan merged 3 commits from AMelonInsideLemon/SpaceNinjaServer:getPastWeeklyChallenges into main 2025-08-08 04:21:19 -07:00
Contributor

Closes #1534

Closes #1534
AMelonInsideLemon added 1 commit 2025-08-06 17:32:57 -07:00
feat: recover nightwave challenges
All checks were successful
Build / build (pull_request) Successful in 55s
869ee9e2a2
Closes #1534
Sainan reviewed 2025-08-06 17:48:02 -07:00
@ -454,0 +442,4 @@
const nightwaveStartDate = new Date(nightwaveStartTimestamp);
const dayOffset = (nightwaveStartDate.getDay() + 6) % 7;
nightwaveStartDate.setDate(nightwaveStartDate.getDate() - dayOffset);
nightwaveStartDate.setHours(0, 0, 0, 0);
Owner

This is dependent on local time.

This is dependent on local time.
Owner

In general, you should be able to divide by 7 days, that's what the EPOCH is for. Otherwise, looks good.

In general, you should be able to divide by 7 days, that's what the EPOCH is for. Otherwise, looks good.
AMelonInsideLemon added 1 commit 2025-08-06 18:17:54 -07:00
use setUCT/getUTC
All checks were successful
Build / build (pull_request) Successful in 1m19s
34fd8951f8
Author
Contributor

In general, you should be able to divide by 7 days, that's what the EPOCH is for. Otherwise, looks good.

You are talking about that offset inside nightwaveWeekStart?

> In general, you should be able to divide by 7 days, that's what the EPOCH is for. Otherwise, looks good. You are talking about that offset inside `nightwaveWeekStart`?
Owner

Yes, I don't see why you don't just use the existing logic to operate on the timestamp itself.

Yes, I don't see why you don't just use the existing logic to operate on the timestamp itself.
Author
Contributor

Right now the Nightwave start date falls on Wednesday, but the rotation of challanges is Monday. And for this I move the nightwaveStartDate to Monday to get correct timestamp to calculate nightwave week number.

Right now the Nightwave start date falls on Wednesday, but the rotation of challanges is Monday. And for this I move the `nightwaveStartDate` to Monday to get correct timestamp to calculate nightwave week number.
Owner

Modular arithmetic, my man.

local EPOCH = 1734307200000
local ts = 1747851300000 - EPOCH
ts -= (ts % 604800000)
print(EPOCH + ts) --> 1747612800000
Modular arithmetic, my man. ```lua local EPOCH = 1734307200000 local ts = 1747851300000 - EPOCH ts -= (ts % 604800000) print(EPOCH + ts) --> 1747612800000 ```
AMelonInsideLemon added 1 commit 2025-08-07 05:04:28 -07:00
use EPOCH instead of setUTC/getUTC
All checks were successful
Build / build (pull_request) Successful in 56s
75faae583f
Sainan approved these changes 2025-08-07 12:31:10 -07:00
Sainan merged commit 679752633a into main 2025-08-08 04:21:19 -07:00
Sainan deleted branch getPastWeeklyChallenges 2025-08-08 04:21:20 -07:00
Sign in to join this conversation.
No description provided.