replace moment with Intl.DateTimeFormat (#597)

This commit is contained in:
Po Chen
2022-05-16 12:54:54 +10:00
committed by GitHub
parent 2139762bca
commit 4598a4e213
3 changed files with 1328 additions and 121 deletions

View File

@@ -1,9 +1,20 @@
import moment from "moment"
import zxcvbn from "zxcvbn"
const dateFormatter = new Intl.DateTimeFormat(
'en-US',
{
weekday: 'short',
month: 'short',
day: 'numeric',
year: 'numeric',
hour: 'numeric',
minute: 'numeric'
}
)
const FormatTimestamp = function (timestamp) {
if (timestamp) {
return moment(timestamp).format("llll z")
return dateFormatter.format(new Date(timestamp))
} else {
return "Never"
}

File diff suppressed because it is too large Load Diff

View File

@@ -18,7 +18,6 @@
"buffer-from": "^1.1.1",
"glob": "^7.1.7",
"highlight.js": "^11.4.0",
"moment": "^2.29.1",
"phoenix": "file:../../../deps/phoenix",
"phoenix_html": "file:../../../deps/phoenix_html",
"phoenix_live_view": "file:../../../deps/phoenix_live_view",