mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-08 22:16:40 +00:00
14 lines
351 B
TypeScript
14 lines
351 B
TypeScript
export function durationToMs(
|
|
value: number,
|
|
unit: "seconds" | "minutes" | "hours" | "days" | "weeks"
|
|
): number {
|
|
const multipliers = {
|
|
seconds: 1000,
|
|
minutes: 60 * 1000,
|
|
hours: 60 * 60 * 1000,
|
|
days: 24 * 60 * 60 * 1000,
|
|
weeks: 7 * 24 * 60 * 60 * 1000
|
|
};
|
|
return value * multipliers[unit];
|
|
}
|