<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>15114</bug_id>
          
          <creation_ts>2011-12-08 15:48:31 +0000</creation_ts>
          <short_desc>forms: new &lt;input&gt; type for YYYY / YYYY-MM / YYYY-MM-DD / YYYY-MM-DD hh:mm, at user&apos;s choice</short_desc>
          <delta_ts>2017-07-21 10:35:06 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WHATWG</product>
          <component>HTML</component>
          <version>unspecified</version>
          <rep_platform>Other</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</resolution>
          
          <see_also>https://www.w3.org/Bugs/Public/show_bug.cgi?id=25742</see_also>
          <bug_file_loc>https://html.spec.whatwg.org/#date-state-(type=date)</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>Needs Impl Interest</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>contributor</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>annevk</cc>
    
    <cc>bfrohs</cc>
    
    <cc>ian</cc>
    
    <cc>mariahbanks2323</cc>
    
    <cc>mike</cc>
    
    <cc>mounir</cc>
    
    <cc>robin</cc>
    
    <cc>slave.loren</cc>
          
          <qa_contact>contributor</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>61242</commentid>
    <comment_count>0</comment_count>
    <who name="">contributor</who>
    <bug_when>2011-12-08 15:48:31 +0000</bug_when>
    <thetext>Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html
Multipage: http://www.whatwg.org/C#date-state
Complete: http://www.whatwg.org/c#date-state

Comment:
A &quot;date-optional-state&quot; should be available, for when the specifity of the
date is unknown. This would give the user the option of selecting a year,
month, or day. Any additional requirements (e.g. required month) can be taken
care of with [pattern]. Would be just like &quot;date-state&quot;, but parameters on end
would be optional (e.g. &quot;YYYY[-MM[-DD]]&quot;). Optionally, &quot;0&quot;s could be used,
rather than omitting (e.g. &quot;YYYY-00-00&quot; or &quot;YYYY-MM-00&quot;). Example use case:
Published Date for books. Publishers sometimes only list a month (esp. when
published on different days across time zones), but more detail is preferred.
Two inputs (&quot;Month&quot; and &quot;Date&quot;) is not possible as it requires a script for
validation ([required] for both locks form) and people try to fill out all
form fields (duplicates is confusing). Using [pattern] as-is is not a solution
as it does not present the user with a date picker.

Posted from: 24.231.239.6 by bfrohs@gmail.com
User agent: Mozilla/5.0 (Ubuntu; X11; Linux i686; rv:8.0) Gecko/20100101 Firefox/8.0</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>61348</commentid>
    <comment_count>1</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-12-09 23:03:04 +0000</bug_when>
    <thetext>I have marked this LATER so that we can look at this again once browsers have caught up with what we&apos;ve specified so far.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84147</commentid>
    <comment_count>2</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-03-08 23:43:15 +0000</bug_when>
    <thetext>Can you elaborate on use cases, ideally with a reference to a page that does something like this so I can study how they expect the UI to work?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>86110</commentid>
    <comment_count>3</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-04-12 23:21:29 +0000</bug_when>
    <thetext>bfrohs: Please see comment 2.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>88620</commentid>
    <comment_count>4</comment_count>
    <who name="Brandon Frohs">bfrohs</who>
    <bug_when>2013-06-04 15:13:14 +0000</bug_when>
    <thetext>(In reply to comment #2)
&gt; Can you elaborate on use cases, ideally with a reference to a page that does
&gt; something like this so I can study how they expect the UI to work?

Apologies for the delay, this got lost in my own personal abyss known as email.

We went ahead and used a plain text input that expects &quot;YYYY-MM-DD&quot; or &quot;YYYY-MM&quot; format. All validation is done server-side, and if a date that doesn&apos;t match the required format is sent, PHP&apos;s `strtotime()` function is run on the provided text, and if it can read it as a valid date, the user is asked if that&apos;s what they meant to provided.

For example, if &quot;January 2013&quot; was provided, `strtotime(&quot;January 2013&quot;)` would be called and the user would be asked if they meant &quot;2013-01-01&quot;. It isn&apos;t ideal by any means, but it gets the job done.

---

Had I had the time to work on a JavaScript date picker, I would have done something like &quot;&lt;- January -&gt; | &lt;- [2013] -&gt;&quot; with the dates listed below like &quot;date&quot; does, where &quot;January&quot; was a link that could be clicked just like any of the days, &quot;&lt;-&quot; and &quot;-&gt;&quot; were buttons that would (in|de)crement the month, and 2013 could be an input box to change the year by a large amount easily.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89202</commentid>
    <comment_count>5</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-06-12 19:33:42 +0000</bug_when>
    <thetext>Right but what is the use case? That is, why do you need a field where some of the data isn&apos;t necessary? I&apos;m just trying to get an idea of where to start researching this kind of thing to work out what the requirements are.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89207</commentid>
    <comment_count>6</comment_count>
    <who name="Brandon Frohs">bfrohs</who>
    <bug_when>2013-06-12 20:23:03 +0000</bug_when>
    <thetext>(In reply to comment #5)
&gt; Right but what is the use case? That is, why do you need a field where some
&gt; of the data isn&apos;t necessary? I&apos;m just trying to get an idea of where to
&gt; start researching this kind of thing to work out what the requirements are.

As mentioned in the original report:

&gt; Example use case: Published Date for books. Publishers sometimes only list a month (esp. when published on different days across time zones), but more detail is preferred.

With that said, although we&apos;d prefer to have the exact date that a book was published (e.g. YYYY-MM-DD), publishers/authors can&apos;t always provide this information. Sometimes they don&apos;t have the information readily available. Other times the book hasn&apos;t been published yet, and while the year or month is set in stone, the month or day hasn&apos;t been yet.

Instead of forcing them to provide either an *exact date* or *nothing*, it&apos;s beneficial to be able to allow them to provide a partial date instead (e.g. YYYY-MM or YYYY). Using two different fields for this purpose would confuse users and be more difficult to achieve on the server&apos;s side of things.

As a side note, it is rather common in the book industry for the day to be left out from the published date, even on sites such on amazon.com:

http://www.amazon.com/dp/1585421464 - Includes day:
&gt; Publisher: Jeremy P. Tarcher/Putnam; 10 Anv edition (March 4, 2002)

http://www.amazon.com/dp/0961392142 - Does not include day:
&gt; Publisher: Graphics Pr; 2nd edition (May 2001)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94204</commentid>
    <comment_count>7</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-10-02 21:00:24 +0000</bug_when>
    <thetext>Hm, interesting. So this is basically a form control that could be anything from type=number (just a year) all the way to type=datetime (a year, month, day, hour, minute, second, time zone offset), and you don&apos;t necessarily know which...

I wonder how common this is. If it&apos;s pretty rare, it might be best to let authors make their own widgets with Web Components for it. If it&apos;s common, we should support it.

Book publication dates are one case (year-month or year-month-day, it seems?). Are there others?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94213</commentid>
    <comment_count>8</comment_count>
    <who name="Brandon Frohs">bfrohs</who>
    <bug_when>2013-10-02 22:56:30 +0000</bug_when>
    <thetext>Yes, year-month or year-month-day, although I&apos;m sure year by itself could be necessary at times for some.

This format also applies to movie/show release dates: http://www.imdb.com/title/tt0111495/releaseinfo (Note USA release date is missing the day).


Also, a &quot;year-month-day&quot; or &quot;year-month-day hour:minute&quot; is another common use, specifically for scheduling events/reminders in the future:

Google Calendar has an &quot;All Day&quot; checkbox when creating a new event that, when checked, hides the second input box for the time for the start/end.

Facebook Events do something similar, but instead of a checkbox, they simply allow you to leave the time input blank. Their date input has a clickable calendar and their time input is a text field that drops down a list of times in 5 minute increments (after you begin typing a time).

In the &quot;Work and Education&quot; of Facebook profiles, you have the ability to enter year, year-month, or year-month-day. Initially, it&apos;s presented as a year select, then you can click &quot;Add month&quot; to choose a month from a second select, then you can click &quot;Add day&quot; to choose a day from a third select.


So, like you suggested, an element that could handle every variation from only the year to the full date would be incredibly useful, so long as it had a minimum amount required (e.g. year-month) and a maximum amount allowed (e.g. year-month-day).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94258</commentid>
    <comment_count>9</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-10-03 19:02:46 +0000</bug_when>
    <thetext>Hm, interesting cases, thanks.

A lot of these cases have explicit UI; it might make sense to just let authors use the existing controls with buttons to switch between them. But I agree that would be somewhat ugly if browsers are willing to implement a single control instead...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124543</commentid>
    <comment_count>10</comment_count>
    <who name="Mya Banks">mariahbanks2323</who>
    <bug_when>2016-01-07 21:40:22 +0000</bug_when>
    <thetext></thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>128742</commentid>
    <comment_count>11</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2017-07-21 10:35:06 +0000</bug_when>
    <thetext>Please file a new issue at https://github.com/whatwg/html/issues/new if there&apos;s still interest.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>