[TYPO3-core] time/date display in FE (and BE)

Michael Stucki michael at typo3.org
Thu Aug 24 14:59:26 CEST 2006


Hi Martin,

next time please post such topics on typo3-dev only. Instead just write a
little reminder to this list where you can ask for feedback. This will help
us to avoid long discussions on this list. It is not meant for that.

Regards, michael

Martin Kutschker wrote:

> [should have been an annoying crosspost but I failed to spell
> [typo3.teams.core]
> 
> Hi!
> 
> Many extensions show dates and times. Some extensions have the format
> configurable (via TS or constants), some not *.
> 
> IMHO there's no need to configure every single extensions. There is even
> an OS suppport for preferred date/time formats: locales. If we don't want
> to use locales we should at least try and use one global (TS not config!)
> value for date, short date and time. Extensions may provide ovverrides but
> should honour the default setting.
> 
> The order of options are therefore:
> 
> OS locale setting
> TYPO3 setting
> extension setting
> 
> For convenience TYPO3 should have an API to get a format. Something like
> this:
> 
> // return format string for strftime()
> // $type = 'date','time','datetime_full','datetime_short'
> function getDateTimeFormat($type) {
>    if (isset($TSFE->config['format_'.$type])) {
>      return $TSFE->config['format_'.$type];
>    }
>    switch ($type) {
>      case 'date':  // eg 08/24/2006 or 24.08.2006
>        return '%x';
>      break;
>      case 'time': // eg 01:43:37 PM or 13:43:37
>        return '%X';
>      break;
>      case 'datetime_full': // Thu 24 Aug 2006 11:44:03 AM CEST
>        return '%c';        // or Do 24 Aug 2006 11:43:01 CEST
>      break;
>      case 'datetime_short':
>        return '%x %X';
>      break;
>    }
>    return '[%c]';
> }
> 
> The function does not do the strftime() because you might want to add some
> other strftime() formats to your output.
> 
> For extensions you could even have extension global defaults with local
> overrides. eg
> 
> plugin.tx_ext_pi1 {
>    format_date = %m/%d/%y
>    single_view.format_date = %c
> }
> 
> And AFAIK there is one global date/time format setting for the BE. But
> this is IMHO bogus as it should be language dependent.
> 
> Masi
> 
> * Indexed search is such an exampe :-(

-- 
Use a newsreader! Check out
http://typo3.org/community/mailing-lists/use-a-news-reader/



More information about the TYPO3-team-core mailing list