glennjones / microformat-shiv

A light weight cross browser JavaScript microformats parser
http://microformatshiv.com
MIT License
136 stars 22 forks source link

hevent dates not parsed correctly #8

Closed mkaply closed 11 years ago

mkaply commented 11 years ago

The hevent that is demoed on this page:

http://microformats.org/wiki/h-event

<div class="h-event">
  <h1 class="p-name">Microformats Meetup</h1>
  <p>From 
    <time class="dt-start" datetime="2013-06-30 12:00">30<sup>th</sup> June 2013, 12:00</time>
    to <time class="dt-end" datetime="2013-06-30 18:00">18:00</time>
    at <span class="p-location">Some bar in SF</span></p>
  <p class="p-summary">Get together and discuss all things microformats-related.</p>
</div>

Is not parsed correctly. The start/end dates end up scrunched together with no T.

Microformats Meetup

From to at Some bar in SF

Get together and discuss all things microformats-related.

mkaply commented 11 years ago

I did a little debugging and it seems like the function isTime is matching on these dates:

2013-06-30 12:00

Around line 623, we're going the "isTime" path with those values.

mkaply commented 11 years ago

Yeah, definitely a problem with isTime. It says anything with a ":" is a time.

I'm not sure of the right way to fix though.

glennjones commented 11 years ago

Yes, this is an unsupported format for ISO dates. I am not sure if the other parse devs have agreed to support this format without telling me, I put as an issue on the parser page http://microformats.org/wiki/microformats2-parsing

I have updated the examples on the wiki so they all have the 'T' delimiter

glennjones commented 11 years ago

OK this turned out to be a new pattern supported in the HTML5 spec for datetime attributes. The library should now parse this pattern