forked from sombochea/verdaccio-ui
fix: time format localization (#471)
This commit is contained in:
parent
1e060474c7
commit
c9910c97b0
@ -50,7 +50,7 @@ describe('formatRepository', (): void => {
|
|||||||
describe('formatDate', (): void => {
|
describe('formatDate', (): void => {
|
||||||
test('should format the date', (): void => {
|
test('should format the date', (): void => {
|
||||||
const date = 1532211072138;
|
const date = 1532211072138;
|
||||||
expect(formatDate(date)).toEqual('21.07.2018, 22:11:12');
|
expect(formatDate(date)).toEqual('07/21/2018 10:11:12 PM');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ describe('formatDateDistance', (): void => {
|
|||||||
describe('getLastUpdatedPackageTime', (): void => {
|
describe('getLastUpdatedPackageTime', (): void => {
|
||||||
test('should get the last update time', (): void => {
|
test('should get the last update time', (): void => {
|
||||||
const lastUpdated = packageMeta._uplinks;
|
const lastUpdated = packageMeta._uplinks;
|
||||||
expect(getLastUpdatedPackageTime(lastUpdated)).toEqual('22.07.2018, 22:11:12');
|
expect(getLastUpdatedPackageTime(lastUpdated)).toEqual('07/22/2018 10:11:12 PM');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should get the last update time for blank uplink', (): void => {
|
test('should get the last update time for blank uplink', (): void => {
|
||||||
@ -91,9 +91,9 @@ describe('getRecentReleases', (): void => {
|
|||||||
test('should get the recent releases', (): void => {
|
test('should get the recent releases', (): void => {
|
||||||
const { time } = packageMeta;
|
const { time } = packageMeta;
|
||||||
const result = [
|
const result = [
|
||||||
{ time: '14.12.2017, 15:43:27', version: '2.7.1' },
|
{ time: '12/14/2017 3:43:27 PM', version: '2.7.1' },
|
||||||
{ time: '05.12.2017, 23:25:06', version: '2.7.0' },
|
{ time: '12/05/2017 11:25:06 PM', version: '2.7.0' },
|
||||||
{ time: '08.11.2017, 22:47:16', version: '2.6.6' },
|
{ time: '11/08/2017 10:47:16 PM', version: '2.6.6' },
|
||||||
];
|
];
|
||||||
expect(getRecentReleases(time)).toEqual(result);
|
expect(getRecentReleases(time)).toEqual(result);
|
||||||
expect(getRecentReleases()).toEqual([]);
|
expect(getRecentReleases()).toEqual([]);
|
||||||
|
@ -5,12 +5,14 @@ import { UpLinks } from '@verdaccio/types';
|
|||||||
import isString from 'lodash/isString';
|
import isString from 'lodash/isString';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import relativeTime from 'dayjs/plugin/relativeTime';
|
import relativeTime from 'dayjs/plugin/relativeTime';
|
||||||
|
import localizedFormat from 'dayjs/plugin/localizedFormat';
|
||||||
|
|
||||||
import { Time } from '../../types/packageMeta';
|
import { Time } from '../../types/packageMeta';
|
||||||
|
|
||||||
export const TIMEFORMAT = 'DD.MM.YYYY, HH:mm:ss';
|
export const TIMEFORMAT = 'L LTS';
|
||||||
|
|
||||||
dayjs.extend(relativeTime);
|
dayjs.extend(relativeTime);
|
||||||
|
dayjs.extend(localizedFormat);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Formats license field for webui.
|
* Formats license field for webui.
|
||||||
|
Loading…
Reference in New Issue
Block a user