UNPKG

lbx-invoice

Version:

Provides functionality around generating invoices.

14 lines 519 B
/** * Formats the given date as YYYYMMDD. * @param value - The date to format. * @returns The formatted date. */ export function dateTo102(value: Date): string { const date: Date = new Date(value); const year: number = date.getFullYear(); const month: number = date.getMonth() + 1; const monthString: string = month > 9 ? `${month}` : `0${month}`; const day: number = date.getDate(); const dayString: string = day > 9 ? `${day}` : `0${day}`; return `${year}${monthString}${dayString}`; }