mirror of
https://github.com/kuhyx/WUT_Computer_Science.git
synced 2026-11-20 23:52:25 +01:00
fix: fix accepting 0 as a valid month day
This commit is contained in:
parent
d37c349efc
commit
9f61157d59
@ -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 -> fail ; DayOfYear is MonthDays + DayNumber).
|
((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