Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Cadabra committed Dec 17, 2024
1 parent 4a33a37 commit 03b0e68
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ All these methods return an instance of `IEnumerator<DateOnly>`.
| dayOfMonth | The day of the month. Takes the last day of the month if `dayOfMonth` is more than the days in the month. |
| dayOfYear | The day of the year. |
| weekDays | Days of the week. |
| numberOfWeek | Index of dayOfWeek in the month. |
| indexOfDay | Index of dayOfWeek in the month. |
| numberOfMonth | The number of the month. |
| firstDayOfWeek | The first day of the week. |

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ public void Dispose()

private static int GetMonthNumber(DateOnly date)
{
return 12 * date.Year + date.Month;
return MonthsInYear * date.Year + date.Month;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ public void Dispose()

private static int GetMonthNumber(DateOnly date)
{
return 12 * date.Year + date.Month;
return MonthsInYear * date.Year + date.Month;
}
}
2 changes: 1 addition & 1 deletion src/DateRecurrenceR/Core/MonthOfYear.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace DateRecurrenceR.Core;
#endif
{
private const int MinVal = 1;
private const int MaxVal = 12;
private const int MaxVal = MonthsInYear;

private readonly int _value;

Expand Down
1 change: 0 additions & 1 deletion src/DateRecurrenceR/Core/WeekDays.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public WeekDays(DayOfWeek day)
/// </summary>
/// <param name="day1"><see cref="DayOfWeek" /></param>
/// <param name="day2"><see cref="DayOfWeek" /></param>

public WeekDays(DayOfWeek day1, DayOfWeek day2)
: this(day1, day2, day2)
{
Expand Down
4 changes: 2 additions & 2 deletions src/DateRecurrenceR/Helpers/MonthlyRecurrenceHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ private static bool DateOutOfRangeByMonth(DateOnly beginDate, int addMonth)

private static int SubtractMonth(DateOnly minuendDate, DateOnly subtractedDate)
{
var minuend = minuendDate.Year * 12 + minuendDate.Month;
var subtracted = subtractedDate.Year * 12 + subtractedDate.Month;
var minuend = minuendDate.Year * MonthsInYear + minuendDate.Month;
var subtracted = subtractedDate.Year * MonthsInYear + subtractedDate.Month;

return minuend - subtracted;
}
Expand Down
1 change: 1 addition & 0 deletions src/DateRecurrenceR/Internals/Constant.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ namespace DateRecurrenceR.Internals;
internal struct Constant
{
public const int DaysInWeek = 7;
public const int MonthsInYear = 12;
}

0 comments on commit 03b0e68

Please sign in to comment.