input date

The date input element let the user enter and edit a date.

The control's user interface varies from browser to browser. It was not styled by FROK (browser native behaviour).

The cross-browser input layout is different. For Chrome/Opera and Microsoft Edge it is designed in FROK style. For Firefox, we use the browser-native look and feel.
According to the Web Content Accessibility Guidelines (WCAG), it is highly recommended to use a label together with the date input.
This component works with all its features only in browsers that have support for the :has CSS selector. Please refer to the reference on MDN.
If you need to run this component in a browser with no support for the :has CSS selector, please use the FROK Release 3.6.x.

component variations

input date

<div class="a-date-input">
  <input type="date" id="date-input-1" name="input date" />
  <button type="button" class="a-date-input__button" aria-label="open dialog">
    <i class="a-icon boschicon-bosch-ic-calendar-clock"></i>
  </button>
</div>

input date readonly

<div class="a-date-input">
  <input
    type="date"
    id="date-input-2"
    name="input date readonly"
    readonly=""
    value="2024-08-20"
  />
  <button type="button" class="a-date-input__button" aria-label="open dialog">
    <i class="a-icon boschicon-bosch-ic-calendar-clock"></i>
  </button>
</div>

input date disabled

<div class="a-date-input">
  <input
    type="date"
    id="date-input-3"
    name="input date disabled"
    disabled=""
    value="2024-08-20"
  />
  <button
    type="button"
    class="a-date-input__button"
    disabled=""
    aria-label="open dialog"
  >
    <i class="a-icon boschicon-bosch-ic-calendar-clock"></i>
  </button>
</div>

input date with label

<div class="a-date-input">
  <label for="date-input-4">Start date:</label>
  <input type="date" id="date-input-4" name="input date with label" />
  <button type="button" class="a-date-input__button" aria-label="open dialog">
    <i class="a-icon boschicon-bosch-ic-calendar-clock"></i>
  </button>
</div>

input date with label readonly

<div class="a-date-input">
  <label for="date-input-5">Start date:</label>
  <input
    type="date"
    id="date-input-5"
    name="input date with label readonly"
    readonly=""
    value="2024-08-20"
  />
  <button type="button" class="a-date-input__button" aria-label="open dialog">
    <i class="a-icon boschicon-bosch-ic-calendar-clock"></i>
  </button>
</div>

input date with label disabled

<div class="a-date-input">
  <label for="date-input-6">Start date:</label>
  <input
    type="date"
    id="date-input-6"
    name="input date with label disabled"
    disabled=""
    value="2024-08-20"
  />
  <button
    type="button"
    class="a-date-input__button"
    disabled=""
    aria-label="open dialog"
  >
    <i class="a-icon boschicon-bosch-ic-calendar-clock"></i>
  </button>
</div>

input date with very long label

<div class="a-date-input">
  <label for="date-input-7">
    Lorem ipsum dolor, sit amet consectetur adipisicing elit. Vitae omnis labore
    consequatur distinctio provident voluptatum nisi recusandae quod asperiores
    quo, architecto cum nesciunt nemo, vel minima possimus et blanditiis
    numquam, cupiditate deserunt fugit delectus earum ducimus alias! Quam atque
    laborum tempore alias magnam tenetur fuga facere totam, harum, ipsa sit!
  </label>
  <input type="date" id="date-input-7" name="input date with very long label" />
  <button type="button" class="a-date-input__button" aria-label="open dialog">
    <i class="a-icon boschicon-bosch-ic-calendar-clock"></i>
  </button>
</div>

input date with very long label readonly

<div class="a-date-input">
  <label for="date-input-8">
    Lorem ipsum dolor, sit amet consectetur adipisicing elit. Vitae omnis labore
    consequatur distinctio provident voluptatum nisi recusandae quod asperiores
    quo, architecto cum nesciunt nemo, vel minima possimus et blanditiis
    numquam, cupiditate deserunt fugit delectus earum ducimus alias! Quam atque
    laborum tempore alias magnam tenetur fuga facere totam, harum, ipsa sit!
  </label>
  <input
    type="date"
    id="date-input-8"
    name="input date with very long label readonly"
    readonly=""
    value="2024-08-20"
  />
  <button type="button" class="a-date-input__button" aria-label="open dialog">
    <i class="a-icon boschicon-bosch-ic-calendar-clock"></i>
  </button>
</div>

input date with very long label disabled

<div class="a-date-input">
  <label for="date-input-9">
    Lorem ipsum dolor, sit amet consectetur adipisicing elit. Vitae omnis labore
    consequatur distinctio provident voluptatum nisi recusandae quod asperiores
    quo, architecto cum nesciunt nemo, vel minima possimus et blanditiis
    numquam, cupiditate deserunt fugit delectus earum ducimus alias! Quam atque
    laborum tempore alias magnam tenetur fuga facere totam, harum, ipsa sit!
  </label>
  <input
    type="date"
    id="date-input-9"
    name="input date with very long label disabled"
    disabled=""
    value="2024-08-20"
  />
  <button
    type="button"
    class="a-date-input__button"
    disabled=""
    aria-label="open dialog"
  >
    <i class="a-icon boschicon-bosch-ic-calendar-clock"></i>
  </button>
</div>

input date with min and max date

<div class="a-date-input">
  <input
    type="date"
    id="date-input-10"
    name="input date with min and max date"
    min="2024-05-01"
    max="2024-05-24"
  />
  <button type="button" class="a-date-input__button" aria-label="open dialog">
    <i class="a-icon boschicon-bosch-ic-calendar-clock"></i>
  </button>
</div>

input date with min and max date over months

<div class="a-date-input">
  <input
    type="date"
    id="date-input-11"
    name="input date with min and max date over months"
    min="2024-05-01"
    max="2024-06-30"
  />
  <button type="button" class="a-date-input__button" aria-label="open dialog">
    <i class="a-icon boschicon-bosch-ic-calendar-clock"></i>
  </button>
</div>

input date with min and max date with step

<div class="a-date-input">
  <input
    type="date"
    id="date-input-12"
    name="input date with min and max date with step"
    min="2024-05-01"
    max="2024-06-30"
    step="7"
  />
  <button type="button" class="a-date-input__button" aria-label="open dialog">
    <i class="a-icon boschicon-bosch-ic-calendar-clock"></i>
  </button>
</div>

additional content

styles SCSS

.a-date-input {
  display: flex;
  min-width: 8.5rem;

  @include text-field;

  @supports (-moz-appearance:none) {
    min-width: 11rem;
  }

  input {
    text-transform: uppercase;

    &::-webkit-datetime-edit-day-field:focus,
    &::-webkit-datetime-edit-month-field:focus,
    &::-webkit-datetime-edit-year-field:focus {
      color: var(--neutral__enabled__front__default);
      background-color: var(--neutral__focused__fill__default);
      mix-blend-mode: multiply;
    }

    &[readonly],
    &:disabled {
      +.a-date-input__button {
        display: none;
      }
    }

    &::-webkit-calendar-picker-indicator {
      display: none;
    }
  }

  @supports (-moz-appearance:none) {
    &__button {
      display: none;
    }
  }
}```