diff --git a/package.json b/package.json index c1b1c95..06ee0e7 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 046767d..32c0b7e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -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==} diff --git a/src/components/Timestamp.astro b/src/components/Timestamp.astro index eab9889..00aab82 100644 --- a/src/components/Timestamp.astro +++ b/src/components/Timestamp.astro @@ -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", +// }); --- -{datestamp} +{format(timestamp, "yyyy MMM d")}