pimcore/studio-ui-bundle

[Schedule] Centralized date formatting service

Closed this issue · 2 comments

I created a similar issue also for the version view: #356

We should ensure that we have the same date formats everywhere and put the date/time/number formatting to centralized services which are re-used everywhere.

Related to #348

I already started with that.
https://github.com/pimcore/studio-ui-bundle/blob/1.x/assets/js/src/core/app/config/date-time.tsx

There would be the place to configure everything.

BUT: We should question us if its really necessary to have a date / time formatted since this is already handled by i18n.
See:

const formattedDate = i18n.format(
new Date(props.timestamp * 1000),
'datetime',
i18n.language
)
or
const formattedDate = i18n.format(
new Date(props.timestamp * 1000),
'datetime',
i18n.language,
{
timeStyle: 'short'
}
)

@Corepex Please create centralized utils as wrapper of I18N to format dates