diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Time/Period.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Time/Period.enso index c20af53b2eed4..88c56e557072e 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Time/Period.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Time/Period.enso @@ -56,7 +56,7 @@ years y = new years=y ensure_period : Any -> Suspend (Any -> Any) -> Text -> Any ! (Time_Error | Illegal_Argument_Error) ensure_period object ~action error_msg="Cannot use Duration as a parameter" = case object of - period : Period -> action + _ : Period -> action _ : Duration.Duration -> Error.throw Time_Error_Data error_msg x -> @@ -157,19 +157,19 @@ type Period compare_to : Period -> Ordering ! (Time_Error | Illegal_Argument_Error) compare_to self that = case self of - Period_With_Date _ start_date_self -> + Period.Period_With_Date _ start_date_self -> case that of - Period_With_Date _ start_date_that -> + Period.Period_With_Date _ start_date_that -> end_date_self = start_date_self + self duration_self = Duration.between start_date_self.to_date_time end_date_self.to_date_time end_date_that = start_date_that + that duration_that = Duration.between start_date_that.to_date_time end_date_that.to_date_time duration_self.compare_to duration_that - Period_Without_Date _ -> + Period.Period_Without_Date _ -> (start_date_self + self).compare_to (start_date_self + that) - Period_Without_Date _ -> + Period.Period_Without_Date _ -> case that of - Period_With_Date _ start_date_that -> + Period.Period_With_Date _ start_date_that -> (start_date_that + self).compare_to (start_date_that + that) - Period_Without_Date _ -> + Period.Period_Without_Date _ -> Error.throw (Time_Error_Data "Cannot compare two Period_Without_Date, as there is no start date") diff --git a/test/Tests/src/Data/Time/Period_Spec.enso b/test/Tests/src/Data/Time/Period_Spec.enso index 34d79005a0c6b..cb65ad5fac11f 100644 --- a/test/Tests/src/Data/Time/Period_Spec.enso +++ b/test/Tests/src/Data/Time/Period_Spec.enso @@ -34,7 +34,7 @@ spec = ((Period.between (Date.new 2022 1 10) (Date.new 2022 1 1)) < (Period.between (Date.new 2022 5 1) (Date.new 2022 5 10))) . should_be_true ((Period.between (Date.new 2022 1 10) (Date.new 2022 1 1)) != (Period.between (Date.new 2022 5 1) (Date.new 2022 5 10))) . should_be_true # 2020 is a leap year, so February in 2020 has more days than February in 2021 - ((Period.between (Date.new 2020 1 2) (Date.new 2020 1 3)) > (Period.between (Date.new 2021 1 2) (Date.new 2021 1 3))) . should_be_true + ((Period.between (Date.new 2020 2 1) (Date.new 2020 3 1)) > (Period.between (Date.new 2021 2 1) (Date.new 2021 3 1))) . should_be_true Test.specify "should compare between Period_With_Date and Period_Without_Date" <| (Period.between (Date.new 2022 1 1) (Date.new 2022 1 2)) == (Period.days 1)