login time
This commit is contained in:
+9
-1
@@ -6,6 +6,14 @@ export const formatTime = (dateInput: string | Date | null | undefined) => {
|
||||
return format(date, "HH:mm");
|
||||
};
|
||||
|
||||
export const formatTimeWithSeconds = (
|
||||
dateInput: string | Date | null | undefined
|
||||
) => {
|
||||
if (!dateInput) return "";
|
||||
const date = typeof dateInput === 'string' ? new Date(dateInput) : dateInput;
|
||||
return format(date, "HH:mm:ss");
|
||||
};
|
||||
|
||||
export const formatDate = (dateInput: string | Date | null | undefined) => {
|
||||
if (!dateInput) return "";
|
||||
const date = typeof dateInput === 'string' ? new Date(dateInput) : dateInput;
|
||||
@@ -32,7 +40,7 @@ export const formatDate = (dateInput: string | Date | null | undefined) => {
|
||||
if (isSameWeek(date, now, { weekStartsOn: 1 })) {
|
||||
return format(date, "EEEE");
|
||||
}
|
||||
return format(date, "dd/MM");
|
||||
return format(date, "MM/dd");
|
||||
};
|
||||
|
||||
export const formatDateMDY = (dateInput: string | Date | null | undefined) => {
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
export enum LoginFailureReason {
|
||||
MISSING_CREDENTIALS = "MISSING_CREDENTIALS",
|
||||
INVALID_CREDENTIALS = "INVALID_CREDENTIALS",
|
||||
WRONG_PASSWORD = "WRONG_PASSWORD",
|
||||
ACCOUNT_LOCKED = "ACCOUNT_LOCKED",
|
||||
NOT_ACTIVATED = "NOT_ACTIVATED",
|
||||
NOT_ALLOWED = "NOT_ALLOWED",
|
||||
UNKNOWN = "UNKNOWN",
|
||||
}
|
||||
|
||||
export const reasonLabel = (reason?: LoginFailureReason | string | null) => {
|
||||
switch (reason) {
|
||||
case "MISSING_CREDENTIALS":
|
||||
return "Missing credentials";
|
||||
case "INVALID_CREDENTIALS":
|
||||
return "Invalid credentials";
|
||||
case "WRONG_PASSWORD":
|
||||
return "Wrong password";
|
||||
case "ACCOUNT_LOCKED":
|
||||
return "Account locked";
|
||||
case "NOT_ACTIVATED":
|
||||
return "Account not activated";
|
||||
case "NOT_ALLOWED":
|
||||
return "Not allowed";
|
||||
case "UNKNOWN":
|
||||
return "Unknown";
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user