wundertec-core
Version:
Librería estándar de utilidades e integraciones AWS + helpers generales
17 lines (14 loc) • 390 B
text/typescript
import moment, { Moment } from "moment-timezone";
const DEFAULT_TZ = process.env.DEFAULT_TIMEZONE || "America/Mexico_City";
/**
* Formatea una fecha según el patrón dado y zona horaria.
*/
export function format(
date: Moment | Date | string,
formatString: string,
timezone?: string
): string {
return moment(date)
.tz(timezone || DEFAULT_TZ)
.format(formatString);
}