You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
477 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

/** MM/DD/YYYY → YYYY-MM-DD供 date input / 服务端校验) */
export function p1DateToIso(display: string): string {
const m = display.trim().match(/^(\d{2})\/(\d{2})\/(\d{4})$/);
if (!m) return "";
return `${m[3]}-${m[1]}-${m[2]}`;
}
/** YYYY-MM-DD → MM/DD/YYYY供 RPA / 展示) */
export function p1DateFromIso(iso: string): string {
const m = iso.trim().match(/^(\d{4})-(\d{2})-(\d{2})$/);
if (!m) return "";
return `${m[2]}/${m[3]}/${m[1]}`;
}