From 6508a39d9495418792c21faf4cd3f68ce96a95bb Mon Sep 17 00:00:00 2001 From: BopannaJ Date: Tue, 19 Dec 2023 17:12:23 +0530 Subject: [PATCH] Added Support for getting qaurter of the year --- src/ReDate_quarter.res | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 src/ReDate_quarter.res diff --git a/src/ReDate_quarter.res b/src/ReDate_quarter.res new file mode 100644 index 0000000..6be0a55 --- /dev/null +++ b/src/ReDate_quarter.res @@ -0,0 +1,9 @@ +let getQuarter = (date: Js.Date.t): int => { + let month = Js.Date.getMonth(date) + switch month { + | _ if month >= 0.0 && month <= 2.0 => 1 + | _ if month >= 3.0 && month <= 5.0 => 2 + | _ if month >= 6.0 && month <= 8.0 => 3 + | _ => 4 + } +}