Ticket #1767 (closed enhancement: fixed)

Opened 14 years ago

Last modified 14 years ago

Custom/locale-based date format

Reported by: gotar Owned by: bilbo
Priority: minor Milestone: 4.7.1
Component: mc-core Version: 4.7.0-pre4
Keywords: Cc:
Blocked By: Blocking:
Branch state: Votes for changeset: committed-master

Description

MTime in panels since always is displayed as:

MMM dD YYYY
MMM dD hh:mm

where:

MMM=abmon
dD=day of month (1 or 2 digits)
YYYY=year
hh:mm=time (24h clock)

This leads to several issues:

  1. obviously MDY order us english-centrific - and illogical, as we don't give e.g. time in hours-seconds-minutes order. For example in polish (language grammar) the only official order is DMY, and YMD is allowed for computer systems (as international ISO-8601 format). Of course having dD MMM hh:mm (when displaying newer files in which case YYYY is replaced with time) would be not so illogical too.
  1. not all languages even have their own official abmons and abdays (like polish). Just take a look at:

http://sourceware.org/bugzilla/show_bug.cgi?id=3156
http://sourceware.org/bugzilla/show_bug.cgi?id=4789
https://bugzilla.redhat.com/show_bug.cgi?id=242296

so current glibc abmons are allowed but not official.

2a. even if abmons are defined, it's bad assumption that they have the same length. For example when glibc team had changed polish to roman numbers (I, II, ... VIII...) there were problems like mentioned here:

https://bugzilla.redhat.com/show_bug.cgi?id=243513

Fortunately this change was eventually reverted and so now we have:

$ LC_TIME=pl_PL locale -k d_fmt abmon t_fmt abday d_t_fmt
d_fmt="%d.%m.%Y"
abmon="sty;lut;mar;kwi;maj;cze;lip;sie;wrz;paź;lis;gru"
t_fmt="%T"
abday="nie;pon;wto;śro;czw;pią;sob"
d_t_fmt="%a, %-d %b %Y, %T"

I think date and time format should be configurable directly by strftime format string with an option to simply follow d_t_fmt. Length of such string could be calculated cycling through all format elements or explicitly given.

Change History

comment:1 Changed 14 years ago by bilbo

  • Status changed from new to accepted
  • Owner set to bilbo
  • severity changed from no branch to on rework

MC use two timeformats - for files with mtime between now and "6 moths old" (like "Nov 2 00:56") and for other files (like "Jun 23 2007")

I think it could be useful to have custom time format in settings for both of these cases - if you want to have same timeformat regardless of file age, you can set both formats to same value.

Then you could be able to set your own timeformat

Created branch 1767_custom_date_format
Initial commit 8716e92640fc29e86e1e27ee4657426c144d976a

comment:2 Changed 14 years ago by gotar

I referred to these two timeformats as 'date' and 'time' - but yes, that's exactly what I have on my mind:) Thnx!

comment:3 Changed 14 years ago by bilbo

  • severity changed from on rework to on review

The patch is in branch 1767_custom_date_format

The timeformat can be configured in ~/.mc/ini in Misc section, using strftime format, like for example the format I am now personally using:

[Misc]
timeformat_recent=%d.%m.%y %H:%M
timeformat_old=%d.%m.%y %H:%M

There is no way (yet) to configure it inside MC, but I guess that would be solved in future by implementing #1516

comment:4 Changed 14 years ago by styx

Not setting to rework, but nothing happens to me when setting (or any thing other):

[Misc]
timeformat_recent=%d.%m.%y %H:%M
timeformat_old=%d.%m.%y %H:%M

comment:5 Changed 14 years ago by bilbo

This is weird, for me it works.

Also, there is already a [Misc] section in the ~/.mc/ini by default, so if there is, you probably need to add just the two lines there, I am not sure how config system will handle two [Misc] sections in the ini file.

If it still is not working - can you post here your entire .mc/ini?

comment:6 Changed 14 years ago by slavazanko

Branch rebased and reworked:

In commit I was add freezing of timeformat variables.

Review, please.

Martin: for update your local branch use commands:

git checkout 1767_custom_date_format
git fetch origin
git reset --hard origin/1767_custom_date_format

comment:7 Changed 14 years ago by metux

  • Votes for changeset set to metux

remember rebasing before merge ;-p

comment:8 Changed 14 years ago by metux

  • Blocked By 1872 added

Didnt pass buildfarm test (see #1872)

comment:9 Changed 14 years ago by styx

  • Type changed from defect to enhancement

comment:10 Changed 14 years ago by slavazanko

  • Blocked By 1872 removed

comment:11 Changed 14 years ago by slavazanko

Branch rebased.

New initial changeset: 83a7b337db7f62f60b96bed1f7587af10010f12f

comment:12 Changed 14 years ago by angel_il

  • Votes for changeset changed from metux to metux angel_il

comment:13 Changed 14 years ago by slavazanko

  • Votes for changeset changed from metux angel_il to metux angel_il slavazanko
  • severity changed from on review to approved

comment:14 Changed 14 years ago by slavazanko

  • Status changed from accepted to testing
  • Votes for changeset changed from metux angel_il slavazanko to commited-master
  • Resolution set to fixed
  • severity changed from approved to merged
  • Milestone changed from 4.7 to 4.7.1

comment:15 Changed 14 years ago by slavazanko

  • Status changed from testing to closed
Note: See TracTickets for help on using tickets.