mirror of
https://github.com/BioArchLinux/bioarchlinux-packages.git
synced 2025-03-10 06:24:00 +00:00
perf(html): format datetime in locale format (current)
This commit is contained in:
parent
3696fe22db
commit
ffbe51bfbe
1 changed files with 10 additions and 1 deletions
|
@ -16,6 +16,11 @@
|
|||
<script src="https://cdn.jsdelivr.net/npm/datatables.net@1.10.20/js/jquery.dataTables.min.js"
|
||||
integrity="sha256-LXQzPhL1IRyKkA7HpCOBi8I+OC8HqzHUYkjK8S+LKTs=" crossorigin="anonymous"></script>
|
||||
<script>
|
||||
const DATE_FORMATTER = new Intl.DateTimeFormat(undefined, {
|
||||
timeStyle: "medium",
|
||||
dateStyle: "medium",
|
||||
hour12: false,
|
||||
});
|
||||
$(document).ready(function () {
|
||||
$('#l').DataTable({
|
||||
"ajax": {
|
||||
|
@ -30,7 +35,11 @@
|
|||
title: "更新时间",
|
||||
data: "updated_at",
|
||||
render: function (data, type, row, meta) {
|
||||
return new Date(data * 1000).toISOString()
|
||||
if (type == 'display') {
|
||||
return DATE_FORMATTER.format(new Date(data * 1000))
|
||||
} else {
|
||||
return data
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue