mirror of
https://github.com/10h30/astroplate.git
synced 2026-06-05 15:08:00 +09:00
update dateFormat using date-fns only
This commit is contained in:
+15
-16
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "astroplate",
|
||||
"version": "3.1.2",
|
||||
"version": "3.2.0",
|
||||
"description": "Astro and Tailwindcss boilerplate",
|
||||
"author": "zeon.studio",
|
||||
"license": "MIT",
|
||||
@@ -14,21 +14,20 @@
|
||||
"remove-darkmode": "node scripts/removeDarkmode.js && yarn format"
|
||||
},
|
||||
"dependencies": {
|
||||
"@astrojs/mdx": "^2.0.2",
|
||||
"@astrojs/react": "^3.0.8",
|
||||
"@astrojs/mdx": "^2.0.3",
|
||||
"@astrojs/react": "^3.0.9",
|
||||
"@astrojs/rss": "^4.0.1",
|
||||
"@astrojs/sitemap": "^3.0.3",
|
||||
"@astrojs/tailwind": "^5.0.4",
|
||||
"astro": "^4.0.7",
|
||||
"@astrojs/sitemap": "^3.0.4",
|
||||
"@astrojs/tailwind": "^5.1.0",
|
||||
"astro": "^4.0.9",
|
||||
"astro-auto-import": "^0.4.2",
|
||||
"date-fns": "^2.30.0",
|
||||
"date-fns-tz": "^2.0.0",
|
||||
"date-fns": "^3.0.6",
|
||||
"disqus-react": "^1.1.5",
|
||||
"github-slugger": "^2.0.0",
|
||||
"gray-matter": "^4.0.3",
|
||||
"marked": "^11.1.0",
|
||||
"prettier-plugin-astro": "^0.12.2",
|
||||
"prettier-plugin-tailwindcss": "^0.5.9",
|
||||
"marked": "^11.1.1",
|
||||
"prettier-plugin-astro": "^0.12.3",
|
||||
"prettier-plugin-tailwindcss": "^0.5.10",
|
||||
"prop-types": "^15.8.1",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
@@ -43,16 +42,16 @@
|
||||
"@tailwindcss/forms": "^0.5.7",
|
||||
"@tailwindcss/typography": "^0.5.10",
|
||||
"@types/marked": "^5.0.2",
|
||||
"@types/node": "20.10.5",
|
||||
"@types/react": "18.2.45",
|
||||
"@types/node": "20.10.6",
|
||||
"@types/react": "18.2.46",
|
||||
"@types/react-dom": "18.2.18",
|
||||
"autoprefixer": "^10.4.16",
|
||||
"eslint": "^8.56.0",
|
||||
"postcss": "^8.4.32",
|
||||
"prettier": "^3.1.1",
|
||||
"prettier-plugin-astro": "^0.12.2",
|
||||
"prettier-plugin-tailwindcss": "^0.5.9",
|
||||
"sass": "^1.69.5",
|
||||
"prettier-plugin-astro": "^0.12.3",
|
||||
"prettier-plugin-tailwindcss": "^0.5.10",
|
||||
"sass": "^1.69.7",
|
||||
"tailwindcss": "^3.4.0",
|
||||
"tailwind-bootstrap-grid": "^5.1.0",
|
||||
"typescript": "5.3.3"
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import { formatInTimeZone } from "date-fns-tz";
|
||||
import { format } from "date-fns";
|
||||
|
||||
const dateFormat = (
|
||||
date: Date | string,
|
||||
format: string = "dd MMM, yyyy",
|
||||
pattern: string = "dd MMM, yyyy",
|
||||
): string => {
|
||||
return formatInTimeZone(date, "America/New_York", format);
|
||||
const dateObj = new Date(date);
|
||||
const output = format(dateObj, pattern);
|
||||
return output;
|
||||
};
|
||||
|
||||
export default dateFormat;
|
||||
|
||||
Reference in New Issue
Block a user