Skip to content

Commit d283be3

Browse files
author
Antonella Sgarlatta
authored
Merge pull request #112 from standardnotes/feature/replace-moment
Replace moment.js with day.js
2 parents dacd6bd + 1270d42 commit d283be3

File tree

7 files changed

+17
-17
lines changed

7 files changed

+17
-17
lines changed

client/app/components/authors/settings/GuestbookEntries.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useState } from "react";
2-
import moment from "moment";
2+
import dayjs from "dayjs";
33
import axios from "axios";
44
import SVG from "react-inlinesvg";
55
import ConfirmationModal from "./ConfirmationModal";
@@ -86,7 +86,7 @@ const GuestbookEntries = ({ guestbookEntries, setErrorToastMessage, setIsErrorTo
8686
</span>
8787
)}
8888
<span className="entry-details__item">
89-
{moment(entry.created_at).format("MMMM D, YYYY")}
89+
{dayjs(entry.created_at).format("MMMM D, YYYY")}
9090
</span>
9191
</p>
9292
{entry.donation_info && entry.donation_info.length > 0 && (

client/app/components/authors/settings/MyPosts.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useState } from "react";
2-
import moment from "moment";
2+
import dayjs from "dayjs";
33
import axios from "axios";
44
import SVG from "react-inlinesvg";
55
import ConfirmationModal from "./ConfirmationModal";
@@ -90,7 +90,7 @@ const MyPosts = ({
9090
</span>
9191
)}
9292
<span className="post-details__item">
93-
{moment(post.created_at).format("MMMM D, YYYY")}
93+
{dayjs(post.created_at).format("MMMM D, YYYY")}
9494
</span>
9595
<span className="post-details__item">
9696
{post.word_count.toLocaleString()}

client/app/components/authors_mailer/UnreadGuestbookEntries.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from "react";
2-
import moment from "moment";
2+
import dayjs from "dayjs";
33

44
export default ({ author, entries }) => (
55
<div>
@@ -16,7 +16,7 @@ export default ({ author, entries }) => (
1616
<p>
1717
<strong>
1818
On
19-
{moment.utc(entry.created_at).format("MMMM D, YYYY HH:mm")}
19+
{dayjs(entry.created_at).format("MMMM D, YYYY HH:mm")}
2020
:
2121
</strong>
2222
</p>

client/app/components/posts/Post.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from "react";
2-
import moment from "moment";
2+
import dayjs from "dayjs";
33
import SVG from "react-inlinesvg";
44
import { IcArrowLong } from "../../assets/icons";
55
import "./Post.scss";
@@ -15,7 +15,7 @@ const Post = ({ truncate, post }) => {
1515
<h5 className="post-title h5">{post.title}</h5>
1616
{post.page || (
1717
<p className="post-date p3">
18-
{`${moment.utc(post.created_at).format("MMMM D, YYYY")} · ${post.word_count} words`}
18+
{`${dayjs(post.created_at).format("MMMM D, YYYY")} · ${post.word_count} words`}
1919
</p>
2020
)}
2121
</div>
@@ -60,7 +60,7 @@ const Post = ({ truncate, post }) => {
6060
)}
6161
{post.page || (
6262
<p className="post-date p3">
63-
{`${moment.utc(post.created_at).format("MMMM D, YYYY")} · ${post.word_count} words`}
63+
{`${dayjs(post.created_at).format("MMMM D, YYYY")} · ${post.word_count} words`}
6464
</p>
6565
)}
6666
</div>

client/app/components/subscription_mailer/WeeklyDigest.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from "react";
2-
import moment from "moment";
2+
import dayjs from "dayjs";
33

44
export default ({ author, posts, unsubscribeUrl }) => {
55
const renderedText = (post) => ({ __html: post.rendered_text });
@@ -19,7 +19,7 @@ export default ({ author, posts, unsubscribeUrl }) => {
1919
</a>
2020
</h3>
2121
<div className="post-content">
22-
<i>{moment.utc(post.created_at).format("MMMM D, YYYY")}</i>
22+
<i>{dayjs(post.created_at).format("MMMM D, YYYY")}</i>
2323
{/* eslint-disable-next-line react/no-danger */}
2424
<div className="post-body" dangerouslySetInnerHTML={renderedText(post)} />
2525
</div>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
"@hcaptcha/react-hcaptcha": "^0.2.1",
99
"@rails/webpacker": "4.2.2",
1010
"axios": "^0.19.2",
11+
"dayjs": "^1.10.4",
1112
"js-yaml": "^3.14.0",
12-
"moment": "^2.27.0",
1313
"react": "^16.13.1",
1414
"react-dom": "^16.13.1",
1515
"react-inlinesvg": "^2.1.0",

yarn.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3483,6 +3483,11 @@ dashdash@^1.12.0:
34833483
dependencies:
34843484
assert-plus "^1.0.0"
34853485

3486+
dayjs@^1.10.4:
3487+
version "1.10.4"
3488+
resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.10.4.tgz#8e544a9b8683f61783f570980a8a80eaf54ab1e2"
3489+
integrity sha512-RI/Hh4kqRc1UKLOAf/T5zdMMX5DQIlDxwUe3wSyMMnEbGunnpENCdbUgM+dW7kXidZqCttBrmw7BhN4TMddkCw==
3490+
34863491
[email protected], debug@^2.2.0, debug@^2.3.3, debug@^2.6.9:
34873492
version "2.6.9"
34883493
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
@@ -6228,11 +6233,6 @@ mixin-deep@^1.2.0:
62286233
dependencies:
62296234
minimist "^1.2.5"
62306235

6231-
moment@^2.27.0:
6232-
version "2.27.0"
6233-
resolved "https://registry.yarnpkg.com/moment/-/moment-2.27.0.tgz#8bff4e3e26a236220dfe3e36de756b6ebaa0105d"
6234-
integrity sha512-al0MUK7cpIcglMv3YF13qSgdAIqxHTO7brRtaz3DlSULbqfazqkc5kEjNrLDOM7fsjshoFIihnU8snrP7zUvhQ==
6235-
62366236
move-concurrently@^1.0.1:
62376237
version "1.0.1"
62386238
resolved "https://registry.yarnpkg.com/move-concurrently/-/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92"

0 commit comments

Comments
 (0)