This commit is contained in:
somebody1234 2023-06-01 00:14:02 +10:00 committed by GitHub
parent 7e53cd9af1
commit 50aefd6746
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,7 +11,7 @@ export type Rfc3339DateTime = newtype.Newtype<string, 'Rfc3339DateTime'>
/** Formats date time into the preferred format: `YYYY-MM-DD, hh:mm`. */
export function formatDateTime(date: Date) {
const year = date.getFullYear()
const month = date.getMonth().toString().padStart(2, '0')
const month = (date.getMonth() + 1).toString().padStart(2, '0')
const dayOfMonth = date.getDate().toString().padStart(2, '0')
const hour = date.getHours().toString().padStart(2, '0')
const minute = date.getMinutes().toString().padStart(2, '0')