hare

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

commit 865184b2dad4fa04612f56eb0d642b47b6044e48
parent 069d28c2684701bf66bf53b577559f29bee0b3c0
Author: Byron Torres <b@torresjrjr.com>
Date:   Tue, 25 Jan 2022 17:06:47 +0000

implement %Z, %z

Depends on fmt::printf()'s "plus" specifier {:+} being implemented.

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

Diffstat:
Mdatetime/format.ha | 10++++------
1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/datetime/format.ha b/datetime/format.ha @@ -260,13 +260,11 @@ fn fmt_specifier(r: rune, dt: *datetime) (str | errors::invalid | io::error) = { case 'Y' => yield strconv::itos(year(dt)); case 'z' => - //yield get_tz_hhmm(dt); - // TODO - yield ""; + // TODO: test + const z = calc_hmsn(dt.zone.zoffset); + yield fmt::asprintf("{:+02}{:02}", z.0, z.1); case 'Z' => - //yield get_tz_name(dt); - // TODO - yield ""; + yield dt.zone.abbr; case '%' => yield "%"; case =>