microformats / tests

Microformats test suite

Home Page:http://microformats.org/wiki/microformats2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

h-event date tests use vcp formatting when it shouldn't

willnorris opened this issue · comments

Relevant files:
https://github.com/microformats/tests/blob/master/tests/microformats-v2/h-event/dates.html
https://github.com/microformats/tests/blob/master/tests/microformats-v2/h-event/dates.json

In the above HTML file, a series of date values are specified using mixed formatting styles. In the JSON file, they are all shown using the canonical format specified at http://ufs.cc/w/vcp (aside: this would be so much easier to link to the exact section if microformats.org support fragmentions! 😄).

However, that canonical format is only specified for VCP datetimes, and I don't think VCP applies in this case, since there is no "value" class present anywhere. In that case, the next step in the parsing rules for dt-x properties says:

if time.dt-x[datetime] or ins.dt-x[datetime] or del.dt-x[datetime], then return the datetime attribute

There's no mention of converting values to the canonical format, so I would think that the expected JSON should be:

{
    "items": [
        {
            "type": [
                "h-event"
            ],
            "properties": {
                "name": [
                    "The 4th Microformat party"
                ],
                "start": [
                    "2009-06-26T19:00-08:00",
                    "2009-06-26T19:00-08",
                    "2009-06-26T19:00-0800",
                    "2009-06-26T19:00+0800",
                    "2009-06-26T19:00+08:00",
                    "2009-06-26T19:00Z",
                    "2009-06-26t19:00-08:00",
                    "2009-06-26 19:00:00-08:00"
                ]
            }
        }
    ],
    "rels": {},
    "rel-urls": {}
}

Am I misreading the dt-x and/or vcp parsing rules, or is this a bug in the above test case?

I think you're right. Trying out http://microformatshiv.com/editor.html with this HTML it looks like this JSON output is what you get when you select html5 for "Experimental ‐ Fixed ISO date profile for output", an option specific to microformats-shiv.

oh right... I do remember the JS library having an option for normalizing date output. I seem to recall there being some discussion about that some time ago. I don't remember the outcome of that discussion, but given what the wiki currently says as well general tendency toward keeping things as close as possible to how it was originally authored, I suspect this should be treated as a bug in the test. I'll send a pull request. Thanks for confirming @gRegorLove

Looks like @jmacdotorg resolved this issue in 8db82c7. 🎉

@gRegorLove (or one of the other maintainers), mind closing this one out?