-
-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
migrate from moment to date-fns (#988)
Last years there are some alternatives to momentjs appeared. Like [date-fns](https://date-fns.org/). Mostly they depend on new [itnl](https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/Intl), that is build in into all modern browsers. Unfortunately, I wasn't able to build the project (I've never touched rust before, and the current cargo version refused to accept configs from repo). That's why I'm not sure that this PR actually works :( If somebody can check, that it builds correctly now - it would be nice to move to less size costly solution like date-fns. Co-authored-by: Eugene <inbox@null.page>
- Loading branch information
Showing
5 changed files
with
199 additions
and
253 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import moment from 'moment' | ||
import { formatDistanceToNow } from 'date-fns' | ||
|
||
export function timeAgo (t: Date): string { | ||
return moment(t).fromNow() | ||
export function timeAgo(t: Date): string { | ||
return formatDistanceToNow(t, { addSuffix: true }) | ||
} |
Oops, something went wrong.