hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 67423a21dc838923b925bcca0648ea2e03c532ef
parent d5851c8cfa58d0bbbc65a54b8cedc2fcf0fe66ae
Author: Vlad-Stefan Harbuz <vlad@vladh.net>
Date:   Fri,  7 Jan 2022 19:48:36 +0100

add is_valid_ymd()

Signed-off-by: Vlad-Stefan Harbuz <vlad@vladh.net>

Diffstat:
Mdatetime/date.ha | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/datetime/date.ha b/datetime/date.ha @@ -35,7 +35,7 @@ fn calc_n_days_in_year(y: int) int = { }; // Calculates whether a given (year, month, date) is valid -export fn is_ymd_valid(y: int, m: int, d: int) bool = { +export fn is_valid_ymd(y: int, m: int, d: int) bool = { return m >= 1 && m <= 12 && d >= 1 && d <= calc_n_days_in_month(y, m); }; @@ -180,7 +180,7 @@ fn calc_zeroweekday(wd: int) int = { // Calculates the [[chrono::epochal]], given a (year, month, day) date fn calc_epochal_from_ymd(y: int, m: int, d: int) (chrono::epochal | errors::invalid) = { - if (!is_ymd_valid(y, m, d)) { + if (!is_valid_ymd(y, m, d)) { return errors::invalid; }; // Algorithm adapted from: