Utils file. Includes date format function.
This commit is contained in:
12
src/utils.js
Normal file
12
src/utils.js
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
const dateString = (date) => {
|
||||
const ye = new Intl.DateTimeFormat('en', { year: 'numeric' }).format(date)
|
||||
const mo = new Intl.DateTimeFormat('en', { month: '2-digit' }).format(date)
|
||||
const da = new Intl.DateTimeFormat('en', { day: '2-digit' }).format(date)
|
||||
|
||||
return `${ye}-${mo}-${da}`
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
dateString
|
||||
}
|
||||
Reference in New Issue
Block a user