Skip to content

vcp: normalize timezone offset #56

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gRegorLove opened this issue Jun 20, 2022 · 7 comments
Closed

vcp: normalize timezone offset #56

gRegorLove opened this issue Jun 20, 2022 · 7 comments

Comments

@gRegorLove
Copy link
Member

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:

  • However the colons ":" separating the hours and minutes of any timezone offset are optional. If the offset uses XX:YY format, remove the colon so it is XXYY format. This makes it less likely that a timezone offset will be confused for a time.

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 microformats/tests#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
Copy link
Member Author

Relevant from this comment #27 (comment)

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

@gRegorLove
Copy link
Member Author

gRegorLove commented Jun 20, 2022

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:

  • ✔️ Go
  • ✔️ php-mf2
  • ❌ mf2py
  • ✔️ Ruby
  • ❌ Haskell
  • ✔️ JS
  • ❌ Rust
  • could not test node, https://node.microformats.io is down currently

@sknebel
Copy link
Member

sknebel commented Jun 21, 2022

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

@aimee-gm
Copy link
Member

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

@jalcine
Copy link
Member

jalcine commented Jun 21, 2022

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
Copy link
Member

jalcine commented Jun 22, 2022

(+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
Copy link
Member Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants