Module talk:ISOdate

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Time zones[edit]

{{editrequest}} As for Module:Date, I modified the sandbox version to handle time zones. The number of combinations of format strings was getting a bit out of hand, so this version parses date, time and time zone separately. Please examine and copy to the live module if desired. --ghouston (talk) 07:39, 6 December 2016 (UTC)

--ghouston, I am a bit afraid to split date and time parsing. The dates that have time are allowed to have 1 digit days or months because it is less likely that those will be confused with something else. Dates with year and month are much more restrictive with other string at the end and less restrictive if whole string matches. I would like to preserve that. Can we just add a standard case with time zone? --Jarekt (talk) 03:56, 10 December 2016 (UTC)
I overlooked that detail. I was puzzled about why it accepted 1 digit days and months at all, when it's not a valid ISO 8601 format. Would it be an option to simply reject them? I'm accepting all the time zone variations: Z, +hhmm, -hhmm, +hh:mm, +hh etc., (although only with a hyphen and not a Unicode minus sign) and time zones can be attached to times that have hours/minutes/seconds or just hours/minutes, so there are a lot of combinations. I guess it wouldn't be hard to add some code to reject the single digit days or months when there's no time attached. --ghouston (talk) 06:58, 10 December 2016 (UTC)
I made that last change, so now it will reject 1 digit days and months if the time isn't present. --ghouston (talk) 03:30, 30 December 2016 (UTC)
Now I'm not sure I understand what you mean. The current version accepts 1 digit days and months when the time isn't present, even if it's not the entire string. E.g., {{ISOdate|1-2-3 stuff}} gives stuff. --ghouston (talk) 21:49, 2 January 2017 (UTC)

Incorrect date for Ukrainian[edit]

In Ukrainian month should be in genitive case: 11 лютого 2017 instead of 11 лютий 2017:

--Anatoliy (talk) 19:06, 11 February 2017 (UTC)

User:Ahonc now "{{ISOdate|2017-02-11|lang=uk}}" gives "" --Jarekt (talk) 21:17, 11 February 2017 (UTC)

Unicode dates[edit]

@Jarekt: Line 58 mw.ustring.match( input, '^+?(-?%d%d?%d?%d?)-' ) allows unicode dates such as those in File:Baleghata_khal.png, but line 60 mw.ustring.format( '%04i', input ) does not allow those and fails with Lua error in Module:ISOdate at line 60: bad argument #2 to 'format' (number expected, got string). How should this be fixed? --Zhuyifei1999 (talk) 21:55, 24 August 2017 (UTC)

Zhuyifei1999, Yes I see {{ISOyear|০৪-১১-২০১৬}} gave error. I think it is fixed now. --Jarekt (talk) 02:42, 26 August 2017 (UTC)

RTL bug[edit]

Hi. The module shows the date in wrong order for rtl user. Could you, please, add ‎ just after the comma? Thank you. IKhitron (talk) 15:53, 12 June 2018 (UTC)

IKhitron, Lets look at some examples:
  • {{ISOdate|1999-08-18|lang=he}} gives ""
  • {{ISOdate|1999-08-18|lang=fa}} gives ""
How should they be modified? --Jarekt (talk) 20:25, 12 June 2018 (UTC)
The date is broken, of course. But I do not think you can do something here, without customizing for each language. I spoke about date and time together, with one of them in the middle of other:
  • {{ISOdate|1={{Commons:Picture of the Year/2017/Rules/Time/data|r1end}}}} gives ""
Thank you, Jarekt. IKhitron (talk) 20:52, 12 June 2018 (UTC)
IKhitron, I see what the issue is: {{ISOdate|1={{Commons:Picture of the Year/2017/Rules/Time/data|r1end}}|lang=he}} gives "". It is not an issue with Module:ISOdate, but with Module:Date and Module:I18n/date where we do "customizing for each language":
  • {{#time: j xg Y, H:i:s|2018-06-24 23:59:59|he}} gives "24 ביוני 2018, 23:59:59" (this is current setting for Hebrew)
  • {{#time: j xg Y,"‎"H:i:s|2018-06-24 23:59:59|he}} gives "24 ביוני 2018,‎23:59:59"
  • {{#time: Y "& lrm;" xg "& lrm;" j,"& lrm;" H:i:s|2018-06-24 23:59:59|he}} gives "2018 ‎ ביוני ‎ 24,‎ 23:59:59"
Would the last option be correct? --Jarekt (talk) 04:22, 13 June 2018 (UTC)
Well, neither. But if you fortunately do have per language customization, Jarekt, here is the right code: {{#time: "<span dir=rtl>"j xg Y"</span>", H:i:s|2018-06-04 23:59:59|he}}. Tests:
4 ביוני 2018, 23:59:59

4 ביוני 2018, 23:59:59

Thank you. IKhitron (talk) 10:27, 13 June 2018 (UTC)
✓ Done IKhitron I deployed your suggested formatting for Hebrew. Thanks. --Jarekt (talk) 12:10, 13 June 2018 (UTC)
Thank you very much for your help, Jarekt. IKhitron (talk) 12:12, 13 June 2018 (UTC)