Update utilities.ts
This commit is contained in:
parent
d70fb531fc
commit
4895fc4f3d
|
@ -13,6 +13,8 @@
|
||||||
* assertUnreachable(user.role);
|
* assertUnreachable(user.role);
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
|
import { DateRange } from 'react-day-picker'
|
||||||
|
|
||||||
export function assertUnreachable(value: never): never {
|
export function assertUnreachable(value: never): never {
|
||||||
throw new Error(`Unreachable case: ${value}`)
|
throw new Error(`Unreachable case: ${value}`)
|
||||||
}
|
}
|
||||||
|
@ -26,3 +28,9 @@ export const convertSecondsToTimerFormat = (seconds: number) => {
|
||||||
export const formatNumberWithComa = (n: number): string => {
|
export const formatNumberWithComa = (n: number): string => {
|
||||||
return n.toFixed(3).replace(/\./g, ',')
|
return n.toFixed(3).replace(/\./g, ',')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const getMonthIndicesFromRange = (range: DateRange) => {
|
||||||
|
if (!range.from || !range.to) return [0, 11]
|
||||||
|
|
||||||
|
return [range.from.getMonth(), range.to.getMonth()]
|
||||||
|
}
|
Loading…
Reference in New Issue