r/AskProgramming • u/r2idw • 6h ago
Javascript help with pseudo code guys.. “new Date()”
Hello everyone,
I’ve recently been struggling with the ‘new Date()’ object in JavaScript.
I wanna understand how to solving that, what I’m trying to achieve is a function that captures the current date once and keeps it unchanged for 5 - 6 days
Once that period has passed, it should capture a new date and keep it unchanged again until the next update
—-
Is there a better way to approach this?
0
Upvotes
View all comments
3
u/r2idw 6h ago
In fact, what I’m trying to build is a rolling 7 day calendar
I want to capture the current date and store it without allowing it to change daily.
The calendar should display that date along with the following six days, keeping all seven dates fixed until the last day of the week is reached.
Once the seventh day has passed, I want to update the stored date with the current date, generate a new set of seven dates, and repeat the same process.