Page MenuHomePhabricator

[Spanish Wikipedia] Function {{#timel:}} won't parse localised date in text format in any language but english
Open, Needs TriagePublic

Description

I'm editing templates, and I want to get the year from a valid date string.

However, when using the functions {{#time:}} and {{#timel:}}, them won't parse string in long, text format localised (eg. "8 de julio de 2000"); when giving the date in english ("July 8, 2000"), it works. I tested in many Wikimedia projects, and in all of them, only the string in english

I know this may be inherited from the PHP functions. So, is there plans to make MediaWiki to accept those strings in any language? Is there another solution? Thanks.

Event Timeline

Amitie_10g renamed this task from [Spanish Wikipedia] Function {{#timel:}} won't parse date in text format in any language but english to [Spanish Wikipedia] Function {{#timel:}} won't parse localised date in text format in any language but english.Apr 26 2019, 2:57 AM
Amitie_10g updated the task description. (Show Details)
Amitie_10g updated the task description. (Show Details)

Hi @Amitie_10g, it's unclear to me 1) which exact steps you perform, 2) what you expected to happen, and 3) what happens instead. Can you please provide a specific, self-contained example which leaves no room for interpretation? Thanks!

If this is about passing something like {{#time: Y | 8 de julio de 2000 }} instead of e.g. {{#time: Y | July 8, 2000 }},
then see https://www.mediawiki.org/wiki/Help:Extension:ParserFunctions##time . It says that

The date/time object can be in any format accepted by PHP's strtotime() function. Both absolute (eg 20 December 2000) and relative (eg +20 hours) times are accepted.

and the formats supported by PHP are listed on https://www.php.net/manual/en/datetime.formats.php

If it's not supported by PHP then this might be a feature request for PHP. https://bugs.php.net/bug.php?id=76123 might be slightly related when it comes to localized versions.