UNPKG

date-picker-np

Version:
11 lines (8 loc) 234 B
export const formatDate = (date?: string) => { if (typeof date !== "string") return ""; date = date.replace(/\s/g, ""); return date .split("-") .map((d) => (d.length === 1 ? d.padStart(2, "0") : d)) .join("-"); };