* feat: api keys v2 - new api keys with pk/sk - domains, wallets and service restriction - secret regeneration completes FTD-1879, FTD-1880, FTD-1835 * minor pr feedback * test jam feedback completes FTD-1902 * show none when no service targets * change copy * enable all services * add service actions fixes FTD-1874 * f * sort saved services * add copy pk on create
20 lines
513 B
TypeScript
20 lines
513 B
TypeScript
import { format, isValid } from "date-fns";
|
|
|
|
const DATE_TIME_LOCAL_FORMAT = "yyyy-MM-dd HH:mm";
|
|
|
|
export function toDateTimeLocal(date?: Date | number | string) {
|
|
if (typeof date === "number") {
|
|
date = new Date(date * 1000);
|
|
} else if (typeof date === "string") {
|
|
date = new Date(date);
|
|
}
|
|
|
|
return date && isValid(date)
|
|
? format(date, DATE_TIME_LOCAL_FORMAT)
|
|
: undefined;
|
|
}
|
|
|
|
export function toDateString(date: Date | string | number) {
|
|
return new Date(date).toISOString().split("T")[0];
|
|
}
|