Login Page - Create Account

Support Board


Date/Time: Wed, 27 Nov 2024 10:41:48 +0000



Post From: Behaviour of sc.GetStartOfPeriodForDateTime

[2023-08-28 12:08:22]
User907968 - Posts: 823
I don't know if something changed, but the behaviour of sc.GetStartOfPeriodForDateTime does not seem to be consistent with the documentation when using TIME_PERIOD_LENGTH_UNIT_WEEKS.

Documentation says:
For periods based on weeks, the start will be either Sunday or Monday depending upon the setting of Global Settings >> General Settings >> General >> Data >> Use Monday as Start of Week instead of Sunday.
and yet, it seems to return the date time for Saturday.

if I include the code below and step through in the debugger, I can see that the AddDays part is executed, which it shouldn't be if the week start is Sunday.


auto sDT = sc.GetStartOfPeriodForDateTime(sc.BaseDateTimeIn[sc.ArraySize - 1], TIME_PERIOD_LENGTH_UNIT_WEEKS, 1, 0);

if (sDT.IsSaturday())
sDT.AddDays(1);

Maybe it is a misunderstanding on my part?