mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-05 19:26:38 +00:00
add support for months (M)
This commit is contained in:
@@ -38,7 +38,16 @@ export const PamAccessAccountModal = ({ isOpen, onOpenChange, account }: Props)
|
|||||||
"years"
|
"years"
|
||||||
];
|
];
|
||||||
|
|
||||||
if (unit === "M" || dayOrLargerUnits.includes(unit.toLowerCase())) {
|
console.log({ unit, duration });
|
||||||
|
|
||||||
|
// ms library does not handle months (M) so we do it separately
|
||||||
|
if (unit === "M") {
|
||||||
|
const value = parseInt(duration, 10);
|
||||||
|
if (!isNaN(value) && value > 0) {
|
||||||
|
const hours = value * 30 * 24;
|
||||||
|
return `${hours}h`;
|
||||||
|
}
|
||||||
|
} else if (dayOrLargerUnits.includes(unit.toLowerCase())) {
|
||||||
const valueInMs = ms(duration);
|
const valueInMs = ms(duration);
|
||||||
const oneHourInMs = 1000 * 60 * 60;
|
const oneHourInMs = 1000 * 60 * 60;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user