more sane date format
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Michael Zhang 2023-10-23 21:50:45 -05:00
parent bd63dba9df
commit 025437ca10
3 changed files with 18 additions and 8 deletions

View file

@ -34,6 +34,7 @@
},
"devDependencies": {
"@types/lodash-es": "^4.17.9",
"date-fns": "^2.30.0",
"hast-util-from-html": "^2.0.1",
"hast-util-to-html": "^9.0.0",
"mdast": "^3.0.0",

View file

@ -70,6 +70,9 @@ devDependencies:
'@types/lodash-es':
specifier: ^4.17.9
version: 4.17.9
date-fns:
specifier: ^2.30.0
version: 2.30.0
hast-util-from-html:
specifier: ^2.0.1
version: 2.0.1
@ -430,7 +433,6 @@ packages:
engines: {node: '>=6.9.0'}
dependencies:
regenerator-runtime: 0.14.0
dev: false
/@babel/template@7.22.15:
resolution: {integrity: sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==}
@ -2278,6 +2280,13 @@ packages:
lodash-es: 4.17.21
dev: false
/date-fns@2.30.0:
resolution: {integrity: sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==}
engines: {node: '>=0.11'}
dependencies:
'@babel/runtime': 7.23.1
dev: true
/dayjs@1.11.10:
resolution: {integrity: sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ==}
dev: false
@ -4814,7 +4823,6 @@ packages:
/regenerator-runtime@0.14.0:
resolution: {integrity: sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA==}
dev: false
/rehype-accessible-emojis@0.3.2:
resolution: {integrity: sha512-kChZo+EZsuFQYHUPu6kOZFjDrG7UtQdGxkrCvHBVo9ariKPL6S68QdPVxLxwcAtZSRZIXZhDuTJHgIM8KW24Qw==}

View file

@ -4,11 +4,12 @@ interface Props {
}
const { timestamp } = Astro.props;
const datestamp = timestamp.toLocaleDateString(undefined, {
year: "numeric",
month: "short",
day: "numeric",
});
import { format } from "date-fns";
// const datestamp = timestamp.toLocaleDateString(undefined, {
// year: "numeric",
// month: "short",
// day: "numeric",
// });
---
<span title={timestamp.toISOString()}>{datestamp}</span>
<span title={timestamp.toISOString()}>{format(timestamp, "yyyy MMM d")}</span>