Improve toFirstDayNumOfWeek infinitesimally

This commit is contained in:
Victor Krasnov 2023-05-23 04:01:44 +00:00
parent 3a3e413552
commit 07d9f33b2e

View File

@ -877,10 +877,11 @@ public:
}
else
{
const auto day_of_week = toDayOfWeek(v);
if constexpr (std::is_unsigned_v<DateOrTime> || std::is_same_v<DateOrTime, DayNum>)
return (toDayOfWeek(v) != 7) ? DayNum(saturateMinus(v, toDayOfWeek(v))) : toDayNum(v);
return (day_of_week != 7) ? DayNum(saturateMinus(v, day_of_week)) : toDayNum(v);
else
return (toDayOfWeek(v) != 7) ? ExtendedDayNum(v - toDayOfWeek(v)) : toDayNum(v);
return (day_of_week != 7) ? ExtendedDayNum(v - day_of_week) : toDayNum(v);
}
}