hare

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

commit f7fbfeac3a048fbd9a59065ad5d42c24142a169e
parent f9c0ba67b3401f51fda61250419b55febb7f1f96
Author: Byron Torres <b@torresjrjr.com>
Date:   Sat, 11 Jun 2022 03:54:47 +0100

datetime: simplify calc_date_from_ywd()

Signed-off-by: Byron Torres <b@torresjrjr.com>

Diffstat:
Mdatetime/date.ha | 6+-----
1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/datetime/date.ha b/datetime/date.ha @@ -240,11 +240,7 @@ fn calc_date_from_ymd(y: int, m: int, d: int) (chrono::date | invalid) = { // given a year, week, and day-of-week. fn calc_date_from_ywd(y: int, w: int, wd: int) (chrono::date | invalid) = { const jan1wd = calc_janfirstweekday(y); - const yd = if (w == 0) { - yield wd - jan1wd + 1; - } else { - yield (7 - jan1wd + 1) + (7 * (w - 1)) + wd; - }; + const yd = wd - jan1wd + 1 + 7 * w; return calc_date_from_yd(y, yd)?; };