gsr
04/08/2024, 12:48 AMgavinbaumanis
04/08/2024, 1:14 AMnow() to
<cfset dtToday = createDate(2024,04,04) />
Then your start of week and end of week are Not Monday ->Sunday
They are Thursday -> Wednesday.gavinbaumanis
04/08/2024, 1:26 AMgavinbaumanis
04/08/2024, 1:29 AMgsr
04/08/2024, 2:00 AMgsr
04/08/2024, 2:00 AMgavinbaumanis
04/08/2024, 2:36 AMgsr
04/08/2024, 2:41 AMgsr
04/08/2024, 2:51 AMgavinbaumanis
04/08/2024, 3:30 AMXXX
...
The results I expect
To see a date this last Monday and another date that is last Monday.
The results I see
A date this last Monday and another date that is last Monday.
My actual question
It seems right - but is it?
Now...
I have a clear understanding of the requirements.
And I can reply with;
"Yes" your code will work for your requirements.
So my answer is sound.
But YOUR original question - doesn't state that it will only ever be used on a Monday and no other day of the week ever needs to be considered.
As a result - "I" have to guess...
"What happens if the user, uses this code on some day that is not a Monday?"
I better add in some more information - because of the "guesses" I have made.
OR
I just reply with
YES that works fine.
And tomorrow - you start getting complaints - because your screen no longer shows a week that starts on a Monday and finished on a Sunday.
Because TODAY is Tuesday - your screen shows a week with a start day of Tuesday, that ends on a Monday.
And that could be EXACTLY what you want.
ALWAYS show me two dates that are week apart - where the start DAY is ALWAYS 1 week ago.
it just isn't clear, from what you have written.gsr
04/08/2024, 3:38 AMgavinbaumanis
04/08/2024, 3:50 AMgsr
04/08/2024, 4:08 AMgavinbaumanis
04/08/2024, 7:28 AMAdam Cameron
dayOfWeek is likely to help you here: https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-c-d/DayOfWeek.html
The general algorithm is gonna be along the lines of:
• get the DOW of the date in question;
• offset that date back to the previous monday (which will be DOW = 2);
• offset that by -1 weeks.cfvonner
04/08/2024, 6:02 PMgavinbaumanis
04/08/2024, 11:03 PMcfvonner
04/08/2024, 11:06 PMgavinbaumanis
04/08/2024, 11:08 PM