Fixing date formatting, attempt 4, now I've checked that polyfill works on my VPS
This commit is contained in:
parent
73e00e2038
commit
3f439e0d9a
1 changed files with 2 additions and 1 deletions
|
@ -2,6 +2,7 @@
|
|||
import ArticleMenu from './ArticleMenu.astro';
|
||||
|
||||
import { AstroComponentFactory } from 'astro/dist/runtime/server';
|
||||
import IntlPolyfill from 'intl';
|
||||
|
||||
export interface Props {
|
||||
PostContent: AstroComponentFactory;
|
||||
|
@ -29,7 +30,7 @@ function formatDate(obj?: Date) {
|
|||
const formatter = (
|
||||
Intl.DateTimeFormat.supportedLocalesOf(locale).length ?
|
||||
Intl.DateTimeFormat :
|
||||
require('intl').DateTimeFormat
|
||||
IntlPolyfill.DateTimeFormat
|
||||
);
|
||||
|
||||
return new formatter(locale).format(obj);
|
||||
|
|
Loading…
Add table
Reference in a new issue