Skip to content
This repository was archived by the owner on Jan 16, 2022. It is now read-only.

Commit a4cdd14

Browse files
ayusharmajuanpicado
authored andcommitted
feat: update date fns to v2 (#232)
* chore: updates date-fns@2 * chore: updates date-fns@2 to new apis * chore: updates date-fns@2, updates format
1 parent 0eb0566 commit a4cdd14

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

jest/unit/components/__mocks__/token.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*/
44

55
import { Base64 } from 'js-base64';
6-
import addHours from 'date-fns/add_hours';
6+
import addHours from 'date-fns/addHours';
77

88
export function generateTokenWithTimeRange(limit = 0) {
99
const payload = {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"concurrently": "5.0.0",
4646
"cross-env": "6.0.3",
4747
"css-loader": "3.2.0",
48-
"date-fns": "1.30.1",
48+
"date-fns": "2.6.0",
4949
"detect-secrets": "1.0.4",
5050
"emotion": "9.2.12",
5151
"enzyme": "3.10.0",

src/utils/package.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ import { isObject } from 'util';
33
import { UpLinks } from '@verdaccio/types';
44
import isString from 'lodash/isString';
55
import format from 'date-fns/format';
6-
import distanceInWordsToNow from 'date-fns/distance_in_words_to_now';
6+
import formatDistanceToNow from 'date-fns/formatDistanceToNow';
77

88
import { Time } from '../../types/packageMeta';
99

10-
export const TIMEFORMAT = 'DD.MM.YYYY, HH:mm:ss';
10+
export const TIMEFORMAT = 'dd.MM.yyyy, HH:mm:ss';
1111

1212
/**
1313
* Formats license field for webui.
@@ -56,7 +56,7 @@ export function formatDate(lastUpdate: string | number): string {
5656
}
5757

5858
export function formatDateDistance(lastUpdate: Date | string | number): string {
59-
return distanceInWordsToNow(new Date(lastUpdate));
59+
return formatDistanceToNow(new Date(lastUpdate));
6060
}
6161

6262
/**

yarn.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4526,16 +4526,16 @@ data-urls@^1.0.0, data-urls@^1.1.0:
45264526
whatwg-mimetype "^2.2.0"
45274527
whatwg-url "^7.0.0"
45284528

4529-
[email protected], date-fns@^1.27.2:
4530-
version "1.30.1"
4531-
resolved "https://registry.verdaccio.org/date-fns/-/date-fns-1.30.1.tgz#2e71bf0b119153dbb4cc4e88d9ea5acfb50dc05c"
4532-
integrity sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw==
4533-
4534-
date-fns@^2.0.1:
4529+
[email protected], date-fns@^2.0.1:
45354530
version "2.6.0"
45364531
resolved "https://registry.verdaccio.org/date-fns/-/date-fns-2.6.0.tgz#a5bc82e6a4c3995ae124b0ba1a71aec7b8cbd666"
45374532
integrity sha512-F55YxqRdEfP/eYQmQjLN798v0AwLjmZ8nMBjdQvNwEE3N/zWVrlkkqT+9seBlPlsbkybG4JmWg3Ee3dIV9BcGQ==
45384533

4534+
date-fns@^1.27.2:
4535+
version "1.30.1"
4536+
resolved "https://registry.verdaccio.org/date-fns/-/date-fns-1.30.1.tgz#2e71bf0b119153dbb4cc4e88d9ea5acfb50dc05c"
4537+
integrity sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw==
4538+
45394539
date-now@^0.1.4:
45404540
version "0.1.4"
45414541
resolved "https://registry.verdaccio.org/date-now/-/date-now-0.1.4.tgz#eaf439fd4d4848ad74e5cc7dbef200672b9e345b"

0 commit comments

Comments
 (0)