mirror of
https://github.com/kuhyx/WUT_Computer_Science.git
synced 2026-07-06 12:03:16 +02:00
fix: Allow for days in month to be equal to max number of days
This commit is contained in:
parent
9f61157d59
commit
1d45a8dd4d
@ -25,7 +25,7 @@ day_of_year(Date, DayOfYear) :-
|
|||||||
atom_chars(Month, MonthChars),
|
atom_chars(Month, MonthChars),
|
||||||
month_days(Month, DaysInMonth, MonthDays),
|
month_days(Month, DaysInMonth, MonthDays),
|
||||||
atom_number(Day, DayNumber),
|
atom_number(Day, DayNumber),
|
||||||
((DayNumber < DaysInMonth, DayNumber > 0) -> DayOfYear is MonthDays + DayNumber) ; fail.
|
((DayNumber <= DaysInMonth, DayNumber > 0) -> DayOfYear is MonthDays + DayNumber) ; fail.
|
||||||
|
|
||||||
% interval(Date1, Date2) prints the number of days between Date1 and Date2
|
% interval(Date1, Date2) prints the number of days between Date1 and Date2
|
||||||
% We always expect date to be in format ddmm where 'd' stands for day and 'm' stands for month
|
% We always expect date to be in format ddmm where 'd' stands for day and 'm' stands for month
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user