mirror of
https://github.com/kuhyx/WUT_Computer_Science.git
synced 2026-07-04 20:03:04 +02: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),
|
||||
month_days(Month, DaysInMonth, MonthDays),
|
||||
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
|
||||
% 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