Skip to content

Commit

Permalink
Use ISOString for getFormattedDate (prettier#15914)
Browse files Browse the repository at this point in the history
Use `ISOString`
  • Loading branch information
sosukesuzuki authored and medikoo committed Feb 17, 2024
1 parent 094ef93 commit 5e6db49
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions scripts/release/get-formatted-date.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
// TODO: Implement this in `utils.js` when jest.importActual is landed.
export default function getFormattedDate() {
const date = new Date();
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, "0");
const day = String(date.getDate()).padStart(2, "0");
const isoStr = date.toISOString();

const year = isoStr.slice(0, 4);
const month = isoStr.slice(5, 7);
const day = isoStr.slice(8, 10);

return { year, month, day };
}

0 comments on commit 5e6db49

Please sign in to comment.