1 parent
0d9aa7b6af
commit
12f91dd1a9
1 file changed
+6
-3
@@ -1,8 +1,11 @@
|
|||||||
// TODO: Implement this in `utils.js` when jest.importActual is landed.
|
// TODO: Implement this in `utils.js` when jest.importActual is landed.
|
||||||
export default function getFormattedDate() {
|
export default function getFormattedDate() {
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
const year = date.getFullYear();
|
const isoStr = date.toISOString();
|
||||||
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
||||||
const day = String(date.getDate()).padStart(2, "0");
|
const year = isoStr.slice(0, 4);
|
||||||
|
const month = isoStr.slice(5, 7);
|
||||||
|
const day = isoStr.slice(8, 10);
|
||||||
|
|
||||||
return { year, month, day };
|
return { year, month, day };
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user