[PATCH] date representation: use ISO8601 rather than a specific locale
Thomas De Schampheleire
patrickdepinguin at gmail.com
Fri Mar 6 08:03:17 EST 2015
On Thu, Feb 26, 2015 at 10:51 PM, Thomas De Schampheleire
<patrickdepinguin at gmail.com> wrote:
> # HG changeset patch
> # User Thomas De Schampheleire <thomas.de.schampheleire at gmail.com>
> # Date 1424987487 -3600
> # Thu Feb 26 22:51:27 2015 +0100
> # Node ID d80090d1053468f6b84eb8ef41c62446995ddb73
> # Parent c7f97c237dacbed8770d4aacf20feb8175ee8d99
> date representation: use ISO8601 rather than a specific locale
>
> Dates, in particular in technical systems like Kallithea, are
> better shown in a clear concise format like ISO8601 (YYYY-MM-DD)
> than in a verbose format like 'Thu, Feb 26 2015'.
>
> This commit changes all dates to ISO8601.
>
> ---
> If desired, we could create two functions: one that returns ISO format and
> another for the locale format. Depending on the usage, one or the other is
> shown. I'm not very fond of that though, it looks inconsistent.
>
> diff --git a/kallithea/lib/helpers.py b/kallithea/lib/helpers.py
> --- a/kallithea/lib/helpers.py
> +++ b/kallithea/lib/helpers.py
> @@ -469,7 +469,7 @@
>
> def fmt_date(date):
> if date:
> - _fmt = u"%a, %d %b %Y %H:%M:%S".encode('utf8')
> + _fmt = u"%Y-%m-%d %H:%M:%S".encode('utf8')
> return date.strftime(_fmt).decode('utf8')
>
config/conf.py actually contains definitions DATETIME_FORMAT and
DATE_FORMAT, included from lib/helpers.py but not used:
DATETIME_FORMAT = "%Y-%m-%d %H:%M:%S"
DATE_FORMAT = "%Y-%m-%d"
We should probably use that instead.
What is the feedback on this patch?
Thanks,
Thomas
More information about the kallithea-general
mailing list