@colisweb/rescript-toolkit 2.65.1 → 2.65.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -60,7 +60,7 @@ let make = (
|
|
|
60
60
|
className={cx([
|
|
61
61
|
"flex flex-row items-center gap-2 cursor-pointer flex-shrink-0",
|
|
62
62
|
className,
|
|
63
|
-
isChecked ? checkedClassName : "",
|
|
63
|
+
isChecked ? `${checkedClassName} cw-switch--checked` : "",
|
|
64
64
|
disabled->Option.getWithDefault(false) ? disabledClassName : "",
|
|
65
65
|
])}>
|
|
66
66
|
<span
|
|
@@ -10,3 +10,18 @@ let wait = ms =>
|
|
|
10
10
|
})
|
|
11
11
|
->Promise.Js.fromBsPromise
|
|
12
12
|
->Promise.Js.toResult
|
|
13
|
+
|
|
14
|
+
let durationMinutesToHourMinutesString = (durationMinutes: float) => {
|
|
15
|
+
let hours = (durationMinutes /. 60.)->Js.Math.trunc
|
|
16
|
+
let minutes = (durationMinutes -. hours *. 60.)->Js.Math.round
|
|
17
|
+
|
|
18
|
+
let hours = minutes === 60. ? hours +. 1. : hours
|
|
19
|
+
let minutes = minutes === 60. ? 0. : minutes
|
|
20
|
+
|
|
21
|
+
switch (hours, minutes) {
|
|
22
|
+
| (0., min) => min->Js.Float.toFixed ++ " min"
|
|
23
|
+
| (h, 0.) => h->Js.Float.toFixed ++ " h"
|
|
24
|
+
| (h, min) =>
|
|
25
|
+
`${h < 10. ? "0" : ""}${h->Js.Float.toFixed}:${min < 10. ? "0" : ""}${min->Js.Float.toFixed}`
|
|
26
|
+
}
|
|
27
|
+
}
|