Fix lint: move pad helper to module scope in date-utils
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
746bbcf531
commit
edae04057d
1 changed files with 2 additions and 1 deletions
|
|
@ -18,6 +18,8 @@
|
||||||
*/
|
*/
|
||||||
import { format } from "date-fns";
|
import { format } from "date-fns";
|
||||||
|
|
||||||
|
const pad = (n: number) => String(n).padStart(2, "0");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Format a YYYY-MM-DD date string for display (e.g. "Apr 9").
|
* Format a YYYY-MM-DD date string for display (e.g. "Apr 9").
|
||||||
* Returns null when the value is missing or unparseable — callers decide how to handle that case.
|
* Returns null when the value is missing or unparseable — callers decide how to handle that case.
|
||||||
|
|
@ -75,7 +77,6 @@ export function utcIsoToLocalDateTime(value: string | Date | null | undefined):
|
||||||
if (!value) return "";
|
if (!value) return "";
|
||||||
const date = value instanceof Date ? value : new Date(value);
|
const date = value instanceof Date ? value : new Date(value);
|
||||||
if (isNaN(date.getTime())) return "";
|
if (isNaN(date.getTime())) return "";
|
||||||
const pad = (n: number) => String(n).padStart(2, "0");
|
|
||||||
const year = date.getFullYear();
|
const year = date.getFullYear();
|
||||||
const month = pad(date.getMonth() + 1);
|
const month = pad(date.getMonth() + 1);
|
||||||
const day = pad(date.getDate());
|
const day = pad(date.getDate());
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue