commit 0fe4ba01727c6e0a448f9a6565c7159e0011914e
parent 7925c4a448199e20a8b4fa53efd41e9bde204af6
Author: Byron Torres <b@torresjrjr.com>
Date: Thu, 7 Mar 2024 00:14:02 +0000
time::date: rename .halfhour to .hour12
Breaking-Change: 0.24.0
Signed-off-by: Byron Torres <b@torresjrjr.com>
Diffstat:
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/time/date/parse.ha b/time/date/parse.ha
@@ -92,7 +92,7 @@ fn parse_specifier(
case 'H' =>
v.hour = scan_int(iter, 2)?;
case 'I' =>
- v.halfhour = scan_int(iter, 2)?;
+ v.hour12 = scan_int(iter, 2)?;
case 'j' =>
v.yearday = scan_int(iter, 3)?;
case 'L' =>
@@ -339,7 +339,7 @@ fn scan_str(iter: *strings::iterator) (str | failure) = {
assert(v.locname is void, "none: non-void locname");
assert(v.zoff is void, "none: non-void zoff");
assert(v.zabbr is void, "none: non-void zabbr");
- assert(v.halfhour is void, "none: non-void halfhour");
+ assert(v.hour12 is void, "none: non-void hour12");
assert(v.ampm is void, "none: non-void ampm");
let v = newvirtual();
@@ -396,8 +396,8 @@ fn scan_str(iter: *strings::iterator) (str | failure) = {
let v = newvirtual();
assert(parse(&v, "%I", "10") is void , "%I: parsefail");
- assert(v.halfhour is int , "%I: void");
- assert(v.halfhour as int == 10 , "%I: incorrect");
+ assert(v.hour12 is int , "%I: void");
+ assert(v.hour12 as int == 10 , "%I: incorrect");
let v = newvirtual();
assert(parse(&v, "%j", "361") is void , "%j: parsefail");
diff --git a/time/date/virtual.ha b/time/date/virtual.ha
@@ -52,7 +52,7 @@ export type virtual = struct {
// zone abbreviation
zabbr: (void | str),
// hour of 12 hour clock
- halfhour: (void | int),
+ hour12: (void | int),
// AM/PM (false/true)
ampm: (void | bool),
};
@@ -88,7 +88,7 @@ export fn newvirtual() virtual = virtual {
locname = void,
zoff = void,
zabbr = void,
- halfhour = void,
+ hour12 = void,
ampm = void,
};
@@ -143,7 +143,7 @@ export fn newvirtual() virtual = virtual {
//
// An empty .hour depends on:
//
-// - .halfhour, .ampm
+// - .hour12, .ampm
//
// If not enough information was provided, [[insufficient]] is returned.
// If invalid information was provided, [[invalid]] is returned.
@@ -233,8 +233,8 @@ export fn realize(
const hour =
if (v.hour is int) {
yield v.hour as int;
- } else if (v.halfhour is int && v.ampm is bool) {
- const hr = v.halfhour as int;
+ } else if (v.hour12 is int && v.ampm is bool) {
+ const hr = v.hour12 as int;
const pm = v.ampm as bool;
yield if (pm) hr * 2 else hr;
} else {