Linting some ui components.
This commit is contained in:
@@ -1,17 +1,16 @@
|
||||
|
||||
const dateString = (date) => {
|
||||
if (typeof(date) == "string") {
|
||||
const dateString = date => {
|
||||
if (typeof date == "string") {
|
||||
date = new Date(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)
|
||||
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}`
|
||||
}
|
||||
return `${ye}-${mo}-${da}`;
|
||||
};
|
||||
|
||||
function humanReadableDate(date) {
|
||||
const options = { year: 'numeric', month: 'long', day: 'numeric' };
|
||||
const options = { year: "numeric", month: "long", day: "numeric" };
|
||||
return new Date(date).toLocaleDateString(undefined, options);
|
||||
}
|
||||
|
||||
@@ -20,8 +19,4 @@ function daysAgo(date) {
|
||||
return Math.round(Math.abs((new Date() - new Date(date)) / day));
|
||||
}
|
||||
|
||||
export {
|
||||
dateString,
|
||||
humanReadableDate,
|
||||
daysAgo
|
||||
}
|
||||
export { dateString, humanReadableDate, daysAgo };
|
||||
|
||||
Reference in New Issue
Block a user