Flood: [Request] Custom date format?

Created on 12 Jun 2017  路  6Comments  路  Source: Flood-UI/flood

Is it possible to be able to set the date format, as currently it's mm/dd/yyyy I'd like something like dd/mm/yyyy?

enhancement help wanted

Most helpful comment

I'll be the necromancer on this issue.

I've looked into how the date rendering is done. At the moment, the date in the torrent list overview is done here: https://github.com/jfurrow/flood/blob/b88c7ff11984c9a9fd71dae97e799f8624459f44/client/src/javascript/components/torrent-list/TorrentDetail.js#L28

This FormattedDate component is a part of react-intl, the documentation for this component can be found here: https://github.com/yahoo/react-intl/wiki/Components#formatteddate

There is no provision to change the string formatting of the date, which is entirely reliant on the locales setting here: https://github.com/jfurrow/flood/blob/aa095625ab8c2255e309b5466e026167a73d3b67/client/src/javascript/app.js#L80
So if you set your language in the settings to en, it assumes en-US. And en-us do the mm/dd/yyyy thing.
I'm not really sure what the best way to proceed would be, besides not using FormattedDate, and using a different component that does allow passing a string formatter. Options here would be Moment.js or Globalize.

I hope this can help you make some progress.

All 6 comments

Agreed, this is a good idea.

Alternatively, yyyy/mm/dd if adding the configuration option is too much work

@jfurrow would you be OK with "2 days ago" instead of the date?

@jfurrow I'm happy to do this if you are OK with it

I'll be the necromancer on this issue.

I've looked into how the date rendering is done. At the moment, the date in the torrent list overview is done here: https://github.com/jfurrow/flood/blob/b88c7ff11984c9a9fd71dae97e799f8624459f44/client/src/javascript/components/torrent-list/TorrentDetail.js#L28

This FormattedDate component is a part of react-intl, the documentation for this component can be found here: https://github.com/yahoo/react-intl/wiki/Components#formatteddate

There is no provision to change the string formatting of the date, which is entirely reliant on the locales setting here: https://github.com/jfurrow/flood/blob/aa095625ab8c2255e309b5466e026167a73d3b67/client/src/javascript/app.js#L80
So if you set your language in the settings to en, it assumes en-US. And en-us do the mm/dd/yyyy thing.
I'm not really sure what the best way to proceed would be, besides not using FormattedDate, and using a different component that does allow passing a string formatter. Options here would be Moment.js or Globalize.

I hope this can help you make some progress.

This bothers me too. It should really just be ISO standard yyyy-mm-dd if it can't be configured with the locale.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

noraj picture noraj  路  4Comments

valdearg picture valdearg  路  3Comments

jr64 picture jr64  路  3Comments

NoLooseEnds picture NoLooseEnds  路  6Comments

bluecmd picture bluecmd  路  3Comments