问题
While Schema.org writes
Here is an example:
<time itemprop="openingHours" datetime="Tu,Th 16:00-20:00">Tuesdays and Thursdays 4-8pm</time>
.
on the HTML5 validator I get this error:
Bad value
Mo, Tu, We, Th, Fr 09:00-16:00
for attributedatetime
on elementtime
: The literal did not satisfy the time-datetime format.…" datetime="Mo, Tu, We, Th, Fr 09:00-16:00">every work day 9am to 16pm </time></li>
I really want to communicate the opening hours (and days) in Microdata, but it seems this is in conflict with HTML5.
Is there a format that is good for both or I should keep it for the bots and care not about valid HTML in this case?
回答1:
I would suggest to keep what you have and not worry about the HTML validator which is only a guide at any rate.
回答2:
Don’t use the time
element.
It’s an error with Schema.org’s documentation. I reported this issue in the Schema.org tracker and it will likely be fixed in the next release.
Possible alternatives:
data element:
<data itemprop="openingHours" value="Tu,Th 16:00-20:00">Tuesdays and Thursdays 4-8pm</data>
meta element (which can be used in the body):
<meta itemprop="openingHours" content="Tu,Th 16:00-20:00"> Tuesdays and Thursdays 4-8pm
来源:https://stackoverflow.com/questions/28088266/proper-datetime-attribute-for-time