You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CronExpression cronExpression = new CronExpression("0 0 12 31W * ?");
DateTime cal = new DateTime(2024, 1, 31, 12, 0, 0).ToUniversalTime();
var nextFireTime = cronExpression.GetTimeAfter((DateTimeOffset)cal);
The exception: System.ArgumentOutOfRangeException
Year, Month, and Day parameters describe an un-representable DateTime.
Version used
3.8.1
To Reproduce
See Describe the bug
Expected behavior
No exception.
Additional context
CronExpression Class line 1747
private SortedSet CalculateDaysOfMonth(DateTimeOffset dt)
{
if.....
//line 1510
else if (nearestWeekday) //AND not lastDay
{
var lastDayOfMonth = GetLastDayOfMonth(dt.Month, dt.Year);
// current
var day = daysOfMonth.Min;
// update to following
var day = Math.Min(daysOfMonth.Min, lastDayOfMonth);
var tcal = new DateTimeOffset(dt.Year, dt.Month, day, 0, 0, 0, dt.Offset);
.....
}
.....
The text was updated successfully, but these errors were encountered:
Describe the bug
CronExpression cronExpression = new CronExpression("0 0 12 31W * ?");
DateTime cal = new DateTime(2024, 1, 31, 12, 0, 0).ToUniversalTime();
var nextFireTime = cronExpression.GetTimeAfter((DateTimeOffset)cal);
The exception: System.ArgumentOutOfRangeException
Year, Month, and Day parameters describe an un-representable DateTime.
Version used
3.8.1
To Reproduce
See Describe the bug
Expected behavior
No exception.
Additional context
CronExpression Class line 1747
private SortedSet CalculateDaysOfMonth(DateTimeOffset dt)
{
if.....
//line 1510
else if (nearestWeekday) //AND not lastDay
{
var lastDayOfMonth = GetLastDayOfMonth(dt.Month, dt.Year);
// current
var day = daysOfMonth.Min;
// update to following
var day = Math.Min(daysOfMonth.Min, lastDayOfMonth);
var tcal = new DateTimeOffset(dt.Year, dt.Month, day, 0, 0, 0, dt.Offset);
.....
}
.....
The text was updated successfully, but these errors were encountered: