Template talk:Time/doc

From Wikivoyage
Jump to navigation Jump to search

12PM and 12AM[edit]

This template is inconsistent with wv:tdf. We don't use "12AM" or "12PM" in Wikivoyage because they are ambiguous. Many people use 12AM to mean noon, so a template that gives the result "12PM (noon)" will be confusing for or just look stupid to those who read 12PM to mean midnight.

There are arguments on both sides for whether 12PM means noon or midnight, but that misses the point that there are readers on both sides of the argument. We should provide information in an unambiguous way by using "noon" and "midnight".

Can anyone fix this? Ground Zero (talk) 13:37, 19 February 2022 (UTC)[reply]

@Ground Zero: Correct me if I misunderstood, but this edit should have fixed this issue. The template now outputs simply "noon" or "midnight" instead of 12AM/PM with said clarifications. -- Wauteurz (talk) 16:23, 19 February 2022 (UTC)[reply]
@Wauteurz: thank you. I think that fixed it. Have a good weekend. Ground Zero (talk) 17:08, 19 February 2022 (UTC)[reply]
@Wauteurz:, @Ground Zero: the problem is still there. The "midnight" in {{time|4:30PM|midnight}} produces the error message. On the other hand {{time|9:30PM|noon}} does not produce such a message.
  • {{time|4:30PM|midnight}}: 4:30PM–Error: Invalid time.Expression error: Unexpected < operator.Error: Invalid time.
  • {{time|9:30PM|noon}}: 9:30PM–noon
Apart from the red message, the mouse-over event displays correct info. --FredTC (talk) 10:34, 20 February 2022 (UTC)[reply]
@FredTC: All you have to do is to enter {{time|4:30PM|12AM}} and it'll produce 4:30PM–midnight with the correct output. Same with noon – type {{time|4:30AM|12PM}} and you get 4:30AM–noon. SHB2000 (talk | contribs | meta.wikimedia) 10:40, 20 February 2022 (UTC)[reply]
@SHB2000: In the edit summary of this edit, Ground Zero indicates the preference for "midnight" over "12AM", mentioning WV:TDF. --FredTC (talk) 11:25, 20 February 2022 (UTC)[reply]
Yes, but it's only the output that has to comply with wv:tdf. SHB2000 (talk | contribs | meta.wikimedia) 11:31, 20 February 2022 (UTC)[reply]
Not to throw shade, but that's on GZ then. {{Time}} is made to output "midnight" or "noon", not to take or understand it as input. It does convert them when used as input, which makes "noon" acceptable as per your examples above, but it is not made to support them. "noon" being accepted as input is more of a fluke than it is design.
The way the template works, is through the ParserFunctions extension, which forces "h" to be the parameter used for the hour in 12-hour format. It therefore converts "midnight" into something it thinks it can make sense of (midnig:t), which breaks the template altogether. "noon" simply works because none of those letters get used in the conversion. It could likely be fixed by altering the template to use 24-hour instead of 12-hour as its basis for conversion, but I am not certain that that'd be easy. I wouldn't want to burn my own hands on it, as my experience and understanding of ParserFunctions pretty much ends here. The easiest fix by far is to use the template as it is made to work, and input the numerical timestamps it expects and make a note of that on the template's documentation page.
-- Wauteurz (talk) 13:23, 20 February 2022 (UTC)[reply]
I have added this note:
""Midnight" is not a valid input for the template. Use "00:00" instead. It will produce "midnight" as the output."
Not a perfect solution, but unless someone can figure out a way around it, it will have to do. Ground Zero (talk) 14:05, 20 February 2022 (UTC)[reply]