From 199ce9e768b33b95e6f721867e6f582bc5236e34 Mon Sep 17 00:00:00 2001 From: Mark A Date: Tue, 16 Feb 2021 08:18:02 -0700 Subject: initial ch-1.raku --- challenge-100/mark-anderson/raku/ch-1.raku | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 challenge-100/mark-anderson/raku/ch-1.raku diff --git a/challenge-100/mark-anderson/raku/ch-1.raku b/challenge-100/mark-anderson/raku/ch-1.raku new file mode 100644 index 0000000000..d3d24e28c9 --- /dev/null +++ b/challenge-100/mark-anderson/raku/ch-1.raku @@ -0,0 +1,26 @@ +use DateTime::Format; +use Time::Piece:from; +use Test; +plan 10; + +is fun-time("00:45"), "12:45 AM"; +is fun-time("01:45"), "01:45 AM"; +is fun-time("03:15"), "03:15 AM"; +is fun-time("13:45"), "01:45 PM"; +is fun-time("18:45"), "06:45 PM"; + +is fun-time("12:45 AM"), "00:45"; +is fun-time("01:45 AM"), "01:45"; +is fun-time("03:15 AM"), "03:15"; +is fun-time("01:45 PM"), "13:45"; +is fun-time("06:45 PM"), "18:45"; + +multi fun-time($T) +{ + strftime("%I:%M %p", DateTime.new("1970-01-01T$T:00Z")); +} + +multi fun-time($T where .ends-with("am"|"pm", :i)) +{ + Time::Piece.strptime("$T", "%r").strftime("%R"); +} -- cgit