input week

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

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

Cross-browser support is currently a bit limited, with only Chrome/Opera and Microsoft Edge supporting it at this time. In non-supporting browsers (e.g. Firefox), the control degrades gracefully to function identically to input of type="text".
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 week

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

input week readonly

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

input week disabled

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

input week with label

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

input week with label readonly

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

input week with label disabled

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

input week with very long label

<div class="a-week-input">
  <label for="week-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="week" id="week-input-7" name="input week with very long label" />
  <button type="button" class="a-week-input__button" aria-label="open dialog">
    <i class="a-icon boschicon-bosch-ic-calendar-clock"></i>
  </button>
</div>

input week with very long label readonly

<div class="a-week-input">
  <label for="week-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="week"
    id="week-input-8"
    name="input week with very long label readonly"
    readonly=""
    value="2024-W20"
  />
  <button type="button" class="a-week-input__button" aria-label="open dialog">
    <i class="a-icon boschicon-bosch-ic-calendar-clock"></i>
  </button>
</div>

input week with very long label disabled

<div class="a-week-input">
  <label for="week-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="week"
    id="week-input-9"
    name="input week with very long label disabled"
    disabled=""
    value="2024-W20"
  />
  <button
    type="button"
    class="a-week-input__button"
    disabled=""
    aria-label="open dialog"
  >
    <i class="a-icon boschicon-bosch-ic-calendar-clock"></i>
  </button>
</div>

input week with min and max date

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

input week with min and max date over months

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

input week with min and max date with step

<div class="a-week-input">
  <input
    type="week"
    id="week-input-12"
    name="input week with min and max date with step"
    min="2024-W24"
    max="2024-W35"
    step="2"
  />
  <button type="button" class="a-week-input__button" aria-label="open dialog">
    <i class="a-icon boschicon-bosch-ic-calendar-clock"></i>
  </button>
</div>

additional content

styles SCSS

.a-week-input {
  display: flex;
  min-width: 14rem;

  @include text-field;

  input {
    text-transform: uppercase;

    &::-webkit-datetime-edit-week-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-week-input__button {
        display: none;
      }
    }

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

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

    label {
      max-width: calc(100% - 2rem);
    }
  }
}```