mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-28 20:53:24 +10:00
Format dates and times as UTC
This commit is contained in:
parent
d58b87ba72
commit
d39973016f
1 changed files with 6 additions and 2 deletions
|
|
@ -58,15 +58,19 @@ export const currencyConfig = {
|
|||
subUnitDivisor: 100,
|
||||
};
|
||||
|
||||
const pad = num => {
|
||||
return num >= 0 && num < 10 ? `0${num}` : `${num}`;
|
||||
};
|
||||
|
||||
// Create fake Internalization object to help with shallow rendering.
|
||||
export const fakeIntl = {
|
||||
formatDate: d => d,
|
||||
formatDate: d => `${d.getUTCFullYear()}-${pad(d.getUTCMonth() + 1)}-${pad(d.getUTCDate())}`,
|
||||
formatHTMLMessage: d => d,
|
||||
formatMessage: msg => msg.id,
|
||||
formatNumber: d => d,
|
||||
formatPlural: d => d,
|
||||
formatRelative: d => d,
|
||||
formatTime: d => d,
|
||||
formatTime: d => `${pad(d.getUTCHours())}:${pad(d.getUTCMinutes())}`,
|
||||
now: d => d,
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue