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 + } +}