Ticket #1484806 (new Patches)

Opened 9 months ago

Last modified 9 months ago

New option to allow strftime to format dates

Reported by: rjhughes Owned by:
Priority: 5 Milestone: later
Component: User Interface Version: 0.1-rc2
Severity: normal Keywords: strftime date format
Cc:

Description (last modified by thomasb) (diff)

Hi. On my system (debian etch), I had the following in my config: $rcmail_config['date_long'] = 'D, M. j g:ia';

This resulted in the months being rendered like: "[feb]". I found that highly strange because I'd never seen that style of formatting. I was expecting "Feb".

From what I read in program/includes/main.inc, the problem seems to be that the php date() function doesn't provide localizations, so Roundcube is doing its own localization. But these localizations are different from the expected system ones. The comment suggested using strftime() instead, which does follow the system's rules.

Therefore, I created a new option for the config: $rcmail_config['date_format_style'] = 'strftime' or 'date' (default: 'date').

If it's set to 'date', then we'll use the current algorithm. If it's 'strftime', then we'll treat the strings like date_long and date_short as being in strftime format, and use that rather than the custom localizations.

I have a patch.

Attachments

strftime.diff (2.6 kB) - added by rjhughes 9 months ago.
Patch to add a date_format_style config option, to use strftime instead of custom localizations.

Change History

Changed 9 months ago by rjhughes

Patch to add a date_format_style config option, to use strftime instead of custom localizations.

Changed 9 months ago by seansan

  • milestone set to 0.1.1

Changed 9 months ago by thomasb

Localization for months is reported here: #1484188

Changed 9 months ago by thomasb

  • description modified (diff)

Better formatting

Changed 9 months ago by rjhughes

By the way, I forgot to mention: My patch is against revision #1139 on trunk.

Changed 9 months ago by thomasb

  • milestone changed from 0.1.1 to later
Note: See TracTickets for help on using tickets.