opening-hours-formats: Difference between revisions

From Microformats Wiki
Jump to navigation Jump to search
(Adds section for schema.org's opening hours type and properties.)
(merging "hCard extension workhours" from /wiki/operating-hours-formats per todo list)
Line 125: Line 125:
</p>
</p>
</pre>
</pre>
== hCard extension workhours ==
Yandex implements a property "workhours" as an extension to [[hCard]], per http://www.step-up-web.ru/hcard/ (from [[articles-ru]])
<blockquote>
workhours — Время работы организации. Свойство не предусмотрено стандартом hCard, оно добавлено Яндексом в качестве расширения. Для указания времени работы мы рекомендуем формат, используемый в Справочнике организаций, например:
* пн-пт 9:00-18:00
* пн-пт 9:00-18:00, обед 13:00-14:00, сб-вс 10:00-17:00, обед 13:30-14:00
* пн-сб 11:00-20:00, вс 12:00-24:00
* ежедн. 10:00-24:00
* круглосуточно
</blockquote>
Translation via Google translate:
<blockquote>
workhours - Time of the organization. The property is not provided by standard hCard, it is added as an extension by Yandex. To specify the working hours, we recommend that the format used in the directory of organizations, such as:
* Mon-Fri 9:00-18:00
* Mon-Fri 9:00-18:00, lunch 13:00-14:00, Sat-Sun 10:00-17:00, lunch 13:30-14:00
* Mon-Sat 11:00-20:00, Sun 12:00-24:00
* Daily. 10:00-24:00
* around the clock
</blockquote>
Since this is a translation, it is not clear if Yandex would support parsing the translated values (they may or may not). However, the translation is still useful for consideration from a design perspective towards a microformats solution.





Revision as of 01:34, 24 February 2021


This is part of an effort per the microformats process to research, gather examples, and brainstorm for a microformat for marking up the opening-hours for a business or organization.


OpenStreetMap

OpenStreetMap allows venues to be tagged with the opening_hours tag. The value of this tag has been formalized and is defined in the TimeDomain specification, where there is also a JavaScript implementation.

Key:opening_hours is also defined on the OSM Wiki.

The same string-based format is used to mark the times of religious services in places of worship using the service_times tag, the times of collections from post boxes with the collection-times tag, and there is a proposal to mark venues which allow smoking (possibly in a separate area) with the smoking_hours tag, and also with the 'lit' tag to specify when a feature (e.g. building) is lit up.

A broader proposal also exists for using the opening_hours format for describing conditional restrictions, for instance roads that have speed limits that vary depending on time of day, and roads that allow only specific types of traffic (buses and bicycles, for instance) during periods of the day.

Comments can also be added in quotations.

Examples:

  • Tu-Su 08:00-15:00;Sa 08:00-12:00 – see node:624582426, a cafe in Terlizzi, Italy.

Google maps display

Google places uses this format to *display* the opening hours, and then applies some javascript to hide the lines which are not immediately useful: The translate the day names and the time formats into the users locale.

This is clearly rendered data for end user consumption and not a format one can use to establish a standard.

See an example here with opening hours: http://maps.google.com/maps/place?cid=17374953169507020841

<table style="" id="oh-ov-table" class="oh-table">
      <tbody>
        <tr class="oh-highlight-day">
          <td class="oh-day">
            Montag
          </td>
          <td dir="ltr">
            11:00-16:00
          </td>
        </tr>
        <tr>
          <td class="oh-day">
            Dienstag
          </td>
          <td dir="ltr">
            11:00-22:00
          </td>
        </tr>
        <tr>
          <td class="oh-day">
            Mittwoch
          </td>
          <td dir="ltr">
            11:00-22:00
          </td>
        </tr>
        <tr>
          <td class="oh-day">
            Donnerstag
          </td>
          <td dir="ltr">
            11:00-22:00
          </td>
        </tr>
        <tr>
          <td class="oh-day">
            Freitag
          </td>
          <td dir="ltr">
            11:00-16:00
          </td>
        </tr>
        <tr>
          <td class="oh-day">
            Samstag
          </td>
          <td dir="ltr">
            Geschlossen
          </td>
        </tr>
        <tr>
          <td class="oh-day">
            Sonntag
          </td>
          <td dir="ltr">
            Geschlossen
          </td>
        </tr>
      </tbody>
    </table>

schema.org

opening hours property

schema.org has an opening hours property. Days are specified with two letter abbreviations, e.g. Mo, Tu, etc.; days can be comma separated for separate days or a range can be specified with a range. Times are specified in 24 hour format. Examples:

  <data lang="en" itemprop="openingHours" value="Mo,We,Fr 09:00-13:00">Open Monday, Wednesday, Friday 9am-1pm</data>
  <data lang="en" itemprop="openingHours" value="Mo-Fr 09:00-13:00">Open Monday-Friday 9am-1pm</data>
  <data lang="fr" itemprop="openingHours" value="Mo,We,Fr 09:00-13:00">Disponible lundi, mercredi, vendredi 9:00-13:00</data>
  <data lang="de" itemprop="openingHours" value="Mo,We,Fr 09:00-13:00">Montag, Mittwoch, Freitag 9:00-13:00</data>

Note: the examples from the schema website use the content attribute on the p element. This does not appear to be allowed in html. These examples were changed to use the data element with the value attribute.

opening hours type

There is also a Opening Hours Specification type, which can use the opening hours property along with more granular properties to specify exceptions, e.g., "open 9-6 except on New Year's Day." This type has a more complex syntax. There is a dayOfWeek property that uses a url to specify the day, e.g. https://schema.org/Tuesday. There are separate properties for opens and closes. Example:

<p>Opening hours</p>
<p itemprop="openingHoursSpecification" itemscope itemtype="https://schema.org/OpeningHoursSpecification">
  <span itemprop="dayOfWeek" href="https://schema.org/Monday">Monday</span>
  <time itemprop="opens" content="09:00">9:00 AM</time> - <time itemprop="closes" content="17:00">5:00 PM</time>
</p>
<p itemprop="openingHoursSpecification" itemscope itemtype="https://schema.org/OpeningHoursSpecification">
  <span itemprop="dayOfWeek" href="https://schema.org/Tuesday">Tuesday</span>
  <time itemprop="opens" content="09:00:00">9:00 AM</time> - <time itemprop="closes" content="17:00:00">5:00 PM</time>
</p>

hCard extension workhours

Yandex implements a property "workhours" as an extension to hCard, per http://www.step-up-web.ru/hcard/ (from articles-ru)

workhours — Время работы организации. Свойство не предусмотрено стандартом hCard, оно добавлено Яндексом в качестве расширения. Для указания времени работы мы рекомендуем формат, используемый в Справочнике организаций, например:

  • пн-пт 9:00-18:00
  • пн-пт 9:00-18:00, обед 13:00-14:00, сб-вс 10:00-17:00, обед 13:30-14:00
  • пн-сб 11:00-20:00, вс 12:00-24:00
  • ежедн. 10:00-24:00
  • круглосуточно

Translation via Google translate:

workhours - Time of the organization. The property is not provided by standard hCard, it is added as an extension by Yandex. To specify the working hours, we recommend that the format used in the directory of organizations, such as:

  • Mon-Fri 9:00-18:00
  • Mon-Fri 9:00-18:00, lunch 13:00-14:00, Sat-Sun 10:00-17:00, lunch 13:30-14:00
  • Mon-Sat 11:00-20:00, Sun 12:00-24:00
  • Daily. 10:00-24:00
  • around the clock

Since this is a translation, it is not clear if Yandex would support parsing the translated values (they may or may not). However, the translation is still useful for consideration from a design perspective towards a microformats solution.


see also