dateformat is a Node.js package for formatting JavaScript dates through readable, reusable mask strings. It adapts Steven Levithan's dateFormat function for module-based Node.js usage without extending the native Date prototype. Developers can build formats from tokens representing days, months, years, hours, minutes, seconds, milliseconds, time zones, and ordinal suffixes. Several predefined masks cover common formats ranging from short dates to ISO date-time strings. Custom masks can be created and reused for application-specific output. Dates can be formatted in local time or converted to UTC and GMT representations. The package also supports localization of weekday names, month names, and AM or PM labels, along with ISO week and weekday values.
Features
- Custom date formatting masks
- Built-in named date formats
- UTC and GMT formatting
- ISO week and weekday tokens
- Localized day and month names
- String, Date, and current-time input support