forked from github-starred/komodo
improve update date format
This commit is contained in:
@@ -268,7 +268,7 @@ export const NewResource = ({
|
||||
enabled={!!name}
|
||||
onOpenChange={() => setName("")}
|
||||
>
|
||||
<div className="grid md:grid-cols-2">
|
||||
<div className="grid md:grid-cols-2 items-center">
|
||||
{type} Name
|
||||
<Input
|
||||
placeholder={`${type_display}-name`}
|
||||
|
||||
@@ -3,11 +3,40 @@ import { Types } from "@monitor/client";
|
||||
export const fmt_date = (d: Date) => {
|
||||
const hours = d.getHours();
|
||||
const minutes = d.getMinutes();
|
||||
return `${d.getDate()}/${d.getMonth() + 1} @ ${
|
||||
return `${fmt_month(d.getMonth())} ${d.getDate()} @ ${
|
||||
hours > 9 ? hours : "0" + hours
|
||||
}:${minutes > 9 ? minutes : "0" + minutes}`;
|
||||
};
|
||||
|
||||
const fmt_month = (month: number) => {
|
||||
switch (month) {
|
||||
case 0:
|
||||
return "Jan";
|
||||
case 1:
|
||||
return "Feb";
|
||||
case 2:
|
||||
return "Mar";
|
||||
case 3:
|
||||
return "Apr";
|
||||
case 4:
|
||||
return "May";
|
||||
case 5:
|
||||
return "Jun";
|
||||
case 6:
|
||||
return "Jul";
|
||||
case 7:
|
||||
return "Aug";
|
||||
case 8:
|
||||
return "Sep";
|
||||
case 9:
|
||||
return "Oct";
|
||||
case 10:
|
||||
return "Nov";
|
||||
case 11:
|
||||
return "Dec";
|
||||
}
|
||||
};
|
||||
|
||||
export const fmt_date_with_minutes = (d: Date) => {
|
||||
// return `${d.toLocaleDateString()} ${d.toLocaleTimeString()}`;
|
||||
return d.toLocaleString();
|
||||
|
||||
Reference in New Issue
Block a user