Snippets Datepicker

Bootstrap 5 Date Range Picker with Week Numbers

A two-month date range picker with ISO week numbers, hover preview of the range, night count, and clear and apply actions, built without a plugin.

Bootstrap 5 No jQuery Jul 2020 2.5K views

<section class="wdw-stage">
  <div class="container" style="max-width:820px">
    <div class="drp wdw-card p-3 p-md-4" id="drp">
      <div class="d-flex justify-content-between align-items-start flex-wrap gap-2 mb-3">
        <div>
          <span class="wdw-eyebrow">Dates</span>
          <h1 class="h4 wdw-heading mb-0">Select your date range</h1>
        </div>
        <span class="badge rounded-pill bg-primary-subtle text-primary-emphasis align-self-center" id="drpNights" aria-live="polite">0 nights</span>
      </div>
      <div class="row g-3 mb-4">
        <div class="col-6">
          <label for="drpStart" class="form-label small fw-semibold">Start date</label>
          <input type="text" id="drpStart" class="form-control drp-field" readonly aria-readonly="true" tabindex="-1" placeholder="dd-mm-yyyy">
        </div>
        <div class="col-6">
          <label for="drpEnd" class="form-label small fw-semibold">End date</label>
          <input type="text" id="drpEnd" class="form-control drp-field" readonly aria-readonly="true" tabindex="-1" placeholder="dd-mm-yyyy">
        </div>
      </div>
      <div class="drp-months" id="drpMonths"></div>
      <div class="d-flex flex-wrap justify-content-between align-items-center gap-2 mt-4 pt-3 border-top">
        <span class="small wdw-muted" id="drpHint" aria-live="polite">Pick a start date.</span>
        <div class="d-flex gap-2">
          <button type="button" class="btn btn-outline-secondary drp-clear rounded-pill" id="drpClear">Clear</button>
          <button type="button" class="btn btn-primary rounded-pill px-4" id="drpApply">Apply</button>
        </div>
      </div>
    </div>
  </div>
</section>

Built on Bootstrap 5.3.8 with plain JavaScript — no jQuery. Supports light and dark mode via data-bs-theme.

Free to use in personal and commercial projects under the MIT license.