File tree 1 file changed +9
-1
lines changed
1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 1
1
"use client" ;
2
2
import { format , parseISO } from "date-fns" ;
3
+ import { enUS , zhTW , Locale as DFLocale } from "date-fns/locale" ;
3
4
import Link from "next/link" ;
4
5
import {
5
6
allPostsNewToOld ,
@@ -10,6 +11,11 @@ import React from "react";
10
11
import { Locale } from "i18n-config" ;
11
12
import { getDictionary } from "get-dictionary" ;
12
13
14
+ const LocaleFromLang : { [ k in Locale ] : DFLocale } = {
15
+ en : enUS ,
16
+ "zh-tw" : zhTW ,
17
+ } ;
18
+
13
19
function useSelectedTags ( ) {
14
20
const [ chosen_tags , set_chosen_tags ] = React . useState < string [ ] > ( [ ] ) ;
15
21
return { chosen_tags, set_chosen_tags } ;
@@ -126,7 +132,9 @@ export default function PostPage({ params }: { params: { lang: Locale } }) {
126
132
< PostNav
127
133
title = { post . title }
128
134
pinned = { post . pinned ?? false }
129
- subtitle = { format ( parseISO ( post . date ) , "LLLL d, yyyy" ) }
135
+ subtitle = { format ( parseISO ( post . date ) , "LLLL d, yyyy" , {
136
+ locale : LocaleFromLang [ params . lang ] ,
137
+ } ) }
130
138
tags = { post . tags }
131
139
content = { post . description }
132
140
buttonName = "Go to"
You can’t perform that action at this time.
0 commit comments