first commit
This commit is contained in:
12
calcom/packages/lib/intervalLimit.ts
Normal file
12
calcom/packages/lib/intervalLimit.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import type { IntervalLimit, IntervalLimitUnit } from "@calcom/types/Calendar";
|
||||
|
||||
export const ascendingLimitKeys: (keyof IntervalLimit)[] = ["PER_DAY", "PER_WEEK", "PER_MONTH", "PER_YEAR"];
|
||||
|
||||
export const descendingLimitKeys = [...ascendingLimitKeys].reverse();
|
||||
|
||||
/**
|
||||
* Turns `PER_DAY` into `day`, `PER_WEEK` into `week` etc.
|
||||
*/
|
||||
export function intervalLimitKeyToUnit(key: keyof IntervalLimit) {
|
||||
return key.split("_")[1].toLowerCase() as IntervalLimitUnit;
|
||||
}
|
||||
Reference in New Issue
Block a user