From 1d45a8dd4d6b4cd78fa49fed4b3f10dfd5ade868 Mon Sep 17 00:00:00 2001 From: Krzysztof Rudnicki Date: Sun, 4 Jun 2023 14:46:13 +0200 Subject: [PATCH] fix: Allow for days in month to be equal to max number of days --- code/main.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/main.pl b/code/main.pl index 21aa8337..6383fdd5 100644 --- a/code/main.pl +++ b/code/main.pl @@ -25,7 +25,7 @@ day_of_year(Date, DayOfYear) :- atom_chars(Month, MonthChars), month_days(Month, DaysInMonth, MonthDays), 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 % We always expect date to be in format ddmm where 'd' stands for day and 'm' stands for month