UNPKG

@feugene/mu

Version:

Helpful TS utilities without dependencies

20 lines 633 B
import { padDateTime } from '../format/pad.mjs'; /** * Date to string in LOCAL time (no timezone suffix). * Example: 2025-12-04T22:58:00 * Note: this uses local getters and is affected by the environment timezone and DST rules. */ export default function toString(date = new Date()) { return (date.getFullYear() + '-' + padDateTime(date.getMonth() + 1) + '-' + padDateTime(date.getDate()) + 'T' + padDateTime(date.getHours()) + ':' + padDateTime(date.getMinutes()) + ':' + padDateTime(date.getSeconds())); } //# sourceMappingURL=toString.mjs.map