Skip to content

Commit

Permalink
Pad date and time in zip-archive file name
Browse files Browse the repository at this point in the history
  • Loading branch information
andgdk committed Dec 13, 2024
1 parent 3bbe24b commit 4a39ee9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/utils/files.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const serializeDateForFileName = (date: Date) =>
`${date.getUTCFullYear()}-${
date.getUTCMonth() + 1
}-${date.getUTCDate()}-${date.getUTCHours()}-${date.getUTCMinutes()}`;
`${date.getUTCFullYear()}-${String(date.getUTCMonth() + 1).padStart(2, "0")}-${
String(date.getUTCDate()).padStart(2, "0")
}-${String(date.getUTCHours()).padStart(2, "0")}-${String(date.getUTCMinutes()).padStart(2, "0")}`;

0 comments on commit 4a39ee9

Please sign in to comment.