microformats / microformats2-parsing

For collecting and handling issues with the microformats2 parsing specification: http://microformats.org/wiki/microformats2-parsing
14 stars 6 forks source link

vcp: normalize timezone offset #56

Closed gRegorLove closed 2 years ago

gRegorLove commented 2 years ago

In https://microformats.org/wiki/value-class-pattern#Date_and_time_parsing

Reference:

  • XX is the time zone hours offset, from 00 to 12 with optional leading 0 for values less than 10.
  • YY is the time zone minutes offset, from 00 to 59, though in practice only 00, 15, 30, 45 minute offsets are used in global timezones.

Change the later line:

  • However the colons ":" separating the hours and minutes of any timezone offset are optional and discouraged in order to make it less likely that a timezone offset will be confused for a time.

To:

The final two bullets in this section seem to imply this behavior by the two timezone examples not including colons. This suggested spec change will make it explicit and also let us resolve https://github.com/microformats/tests/issues/29.

  • YYYY-MM-DD HH:MM-XXYY or YYYY-MM-DD HH:MM:SS-XXYY or
  • YYYY-MM-DD HH:MM+XXYY or YYYY-MM-DD HH:MM:SS+XXYY - both time and timezone offset were specified.
gRegorLove commented 2 years ago

Relevant from this comment https://github.com/microformats/microformats2-parsing/issues/27#issuecomment-376004491

The list of possible VCP assembled output syntaxes was intended to be comprehensive.

gRegorLove commented 2 years ago

Testing current parsers:

<div class="h-event">
    <h1 class="p-name">Happy 17th birthday microformats.org</h1>
    <p class="dt-start">
        <time class="value" datetime="2022-06-20">20 June</time>, from
        <time class="value">00:00-08:00</time> 
    </p>
</div>

Normalizes timezone offset as described above:

sknebel commented 2 years ago

sounds reasonable to me (+1 with hat as mf2py contributor)

aimee-gm commented 2 years ago

The working JS parser: https://github.com/microformats/microformats-parser

jalcine commented 2 years ago

Throwing in the Rust parser into the mix at https://rust.microformats.io, it defaults to adding colons in offsets if they were provided initially.

(Originally published at: https://jacky.wtf/2022/6/S0Jx)

jalcine commented 2 years ago

(+1) I'm in favor of the change of normalizing the timezone offset such that the colon is not present. The Rust implementation is currently capable of checking if it was there when it was authored. If it's either always or not present, there's a bit of logic I can remove (less code is good).

(Originally published at: https://jacky.wtf/2022/6/Kwm5)

gRegorLove commented 2 years ago

Resolution: proposal accepted.

No objections in above discussion, 4 parsers already implement it, and positive opinions (+1) from a few implementers on the proposal.

Updated spec with this revision: https://microformats.org/wiki/index.php?title=value-class-pattern&oldid=70522