Conversation
Do not add "T" separator if it's not in the authored HTML. Normalize timezone offsets to remove colons Imply timezone offset if included in another dt- in the same microformat
Mf2/Parser.php
Outdated
There was a problem hiding this comment.
Why the added ? here? That makes the T optional. Should this instead be checking for a as well as T?
Mf2/Parser.php
Outdated
There was a problem hiding this comment.
This should match Z OR +00:00, so probably a better regex would be
/(Z|[+-]\d{2}:?\d{2})/
There was a problem hiding this comment.
Since the timezone may also only be hours, updated this to /^(Z|[+-]\d{2}:?(\d{2})?)$/
Mf2/Parser.php
Outdated
There was a problem hiding this comment.
What's the reason for making the minutes part optional here? It looks like the change is adding the ? to the minutes part of the timezone offset. Like the above, this should probably be changed to (Z|[+-]\d{2}:?\d{2})
I know this wasn't your change, but [a|p] and [+|-] is incorrect, since the regex is using [] you only need [ap] and [+-].
There was a problem hiding this comment.
Hour-only timezone offsets (+XX, -XX) are valid according to the VCP spec. I updated the am/pm regex in both locations to handle optional periods as well [ap]\.?m\.?
Edit: Re-reading, hour-only timezone offsets appear to only be valid if they appear in their own VCP element, separate from the time. Not sure if that's an oversight in the time+timezone section or not.
Mf2/Parser.php
Outdated
There was a problem hiding this comment.
Do you need to match the colon here as well?
/[+-]\d{2}:?\d{2}/
There was a problem hiding this comment.
This is after the new method normalizeTimezoneOffset() is called, which removes the colon. This isn't explicitly stated in the spec, but I inferred it from: (bold is my emphasis)
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.
|
@aaronpk Updated.the regexes and TZ normalization. Can you review? |
Fixes #115 and #126