Skip to content

ccusage / data-loader / formatDateCompact

Function: formatDateCompact()

ts
function formatDateCompact(
   dateStr, 
   timezone, 
   locale): string;

Formats a date string to compact format with year on first line and month-day on second

Parameters

ParameterTypeDescription
dateStrstringInput date string
timezoneundefined | stringTimezone to use for formatting (pass undefined to use system timezone)
localestringLocale to use for formatting

Returns

string

Formatted date string with newline separator (YYYY\nMM-DD)

Released under the MIT License.