fix date format
This commit is contained in:
@@ -10,7 +10,7 @@ describe('formatIsk', () => {
|
||||
describe('formatEveDate', () => {
|
||||
test('Formats EVE date correctly', () => {
|
||||
const date = new Date(Date.UTC(2022, 0, 1, 0, 0))
|
||||
expect(formatEveDate(date)).toBe('2022.1.1 0:0')
|
||||
expect(formatEveDate(date)).toBe('2022.01.01 00:00')
|
||||
})
|
||||
|
||||
test('Returns empty string for undefined date', () => {
|
||||
|
||||
@@ -11,4 +11,10 @@ export const percentFormater = new Intl.NumberFormat("en-US", {
|
||||
maximumFractionDigits: 0
|
||||
});
|
||||
|
||||
export const formatEveDate = (date?: Date | null) => !date ? '' : `${date.getUTCFullYear()}.${date.getUTCMonth() + 1}.${date.getUTCDate()} ${date.getUTCHours()}:${date.getUTCMinutes()}`;
|
||||
export const timeFormat = new Intl.NumberFormat("en-US", {
|
||||
minimumFractionDigits: 0,
|
||||
maximumFractionDigits: 0,
|
||||
minimumIntegerDigits: 2
|
||||
});
|
||||
|
||||
export const formatEveDate = (date?: Date | null) => !date ? '' : `${date.getUTCFullYear()}.${timeFormat.format(date.getUTCMonth() + 1)}.${timeFormat.format(date.getUTCDate())} ${timeFormat.format(date.getUTCHours())}:${timeFormat.format(date.getUTCMinutes())}`;
|
||||
Reference in New Issue
Block a user