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.
|
||||
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 };
|
||||
}
|
||||
Reference in new issue
Block a user