From 8cba6c3c24c2122c843aa0feaa26fd6e5c2412e2 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 30 Mar 2025 17:27:52 -0400 Subject: Deprecate built-in Moment datatype in favor of a `time` module --- test/moments.tm | 49 ------------------------------------------------- test/serialization.tm | 6 ------ 2 files changed, 55 deletions(-) delete mode 100644 test/moments.tm (limited to 'test') diff --git a/test/moments.tm b/test/moments.tm deleted file mode 100644 index 657c1522..00000000 --- a/test/moments.tm +++ /dev/null @@ -1,49 +0,0 @@ - -func main(): - >> 2024-1-1 12:00[America/New_York] == 2024-1-1T09:00[America/Los_Angeles] - = yes - >> 2024-1-1 12:00[America/New_York] == Moment(2024, 1, 1, hour=9, timezone="America/Los_Angeles") - = yes - - >> t := 2024-1-2 13:45[America/New_York] - >> t:after(days=40) == 2024-2-11T13:45:00[America/New_York] - = yes - >> t:date(timezone="America/New_York") - = "2024-01-02" - - >> t:time(timezone="America/New_York") - = "1:45pm" - - >> t:time(am_pm=no, timezone="America/New_York") - = "13:45" - - >> t:relative(relative_to=t:after(minutes=65)) - = "1 hour ago" - - >> t:seconds_till(t:after(minutes=2)) - = 120. - - >> t:minutes_till(t:after(minutes=2)) - = 2. - - >> t:hours_till(t:after(minutes=60)) - = 1. - - >> t:day_of_week() # 1 = Sun, 2 = Mon, 3 = Tue - = 3 - - >> t:format("%A") - = "Tuesday" - - >> t:unix_timestamp() - = Int64(1704221100) - >> t == Moment.from_unix_timestamp(1704221100) - = yes - - >> t < t:after(minutes=1) - = yes - - >> t < t:after(seconds=0.1) - = yes - - >> now() diff --git a/test/serialization.tm b/test/serialization.tm index 9afb4bcf..6d08552f 100644 --- a/test/serialization.tm +++ b/test/serialization.tm @@ -4,12 +4,6 @@ struct Foo(name:Text, next=none:@Foo) enum MyEnum(Zero, One(x:Int), Two(x:Num, y:Text)) func main(): - do: - >> obj := now() - >> bytes := obj:serialized() - >> deserialize(bytes -> Moment) == obj - = yes - do: >> obj := Int64(123) >> bytes := obj:serialized() -- cgit v1.2.3