mirror of
https://github.com/mastermindzh/rickvanlieshout.com
synced 2025-07-26 04:04:27 +02:00
Remove the use of Moment.js.
This is a heavy library that is hardly used, in addition, it is already quite deprecated, see here: https://momentjs.com/docs/#/-project-status/
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
// @flow strict
|
||||
import React from 'react';
|
||||
import moment from 'moment';
|
||||
import { Link } from 'gatsby';
|
||||
import type { Edges } from '../../types';
|
||||
import styles from './Feed.module.scss';
|
||||
@@ -14,8 +13,8 @@ const Feed = ({ edges }: Props) => (
|
||||
{edges.map((edge) => (
|
||||
<div className={styles['feed__item']} key={edge.node.fields.slug}>
|
||||
<div className={styles['feed__item-meta']}>
|
||||
<time className={styles['feed__item-meta-time']} dateTime={moment(edge.node.frontmatter.date).format('MMMM D, YYYY')}>
|
||||
{moment(edge.node.frontmatter.date).format('MMMM YYYY')}
|
||||
<time className={styles['feed__item-meta-time']} dateTime={ new Date(edge.node.frontmatter.date).toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' })}>
|
||||
{ new Date(edge.node.frontmatter.date).toLocaleDateString('en-US', { year: 'numeric', month: 'long' })}
|
||||
</time>
|
||||
<span className={styles['feed__item-meta-divider']} />
|
||||
<span className={styles['feed__item-meta-category']}>
|
||||
|
@@ -1,6 +1,5 @@
|
||||
// @flow strict
|
||||
import React from 'react';
|
||||
import moment from 'moment';
|
||||
import styles from './Meta.module.scss';
|
||||
|
||||
type Props = {
|
||||
@@ -9,7 +8,7 @@ type Props = {
|
||||
|
||||
const Meta = ({ date }: Props) => (
|
||||
<div className={styles['meta']}>
|
||||
<p className={styles['meta__date']}>Published {moment(date).format('D MMM YYYY')}</p>
|
||||
<p className={styles['meta__date']}>Published {new Date(date).toLocaleDateString('en-US', { year: 'numeric', month: 'short', day: 'numeric' })}</p>
|
||||
</div>
|
||||
);
|
||||
|
||||
|
Reference in New Issue
Block a user