Convert Figma logo to code with AI

uxsolutions logobootstrap-datepicker

A datepicker for twitter bootstrap (@twbs)

12,664
6,068
12,664
884

Top Related Projects

16,122

lightweight, powerful javascript datetimepicker with no dependencies

8,000

A refreshing JavaScript Datepicker — lightweight, no dependencies, modular CSS

JavaScript Date Range, Date and Time Picker Component

⚠️ [Deprecated] No longer maintained. A simple jQuery datepicker plugin.

Quick Overview

Bootstrap-datepicker is a flexible and customizable date picker plugin for Bootstrap. It provides an easy-to-use interface for selecting dates, date ranges, and months, with support for various display formats and localization options. The plugin is designed to seamlessly integrate with Bootstrap's styling and components.

Pros

  • Easy integration with Bootstrap projects
  • Extensive customization options and flexibility
  • Support for multiple languages and localization
  • Responsive design and mobile-friendly

Cons

  • Requires jQuery as a dependency
  • May have compatibility issues with newer Bootstrap versions (4+)
  • Limited support for complex date selection scenarios
  • Some reported issues with performance on large date ranges

Code Examples

  1. Basic date picker initialization:
$('#datepicker').datepicker({
    format: 'mm/dd/yyyy',
    startDate: '-3d'
});
  1. Date range selection:
$('#date-range').datepicker({
    inputs: $('.date-range-input'),
    format: 'yyyy-mm-dd'
});
  1. Inline calendar display:
$('#inline-calendar').datepicker({
    calendarWeeks: true,
    todayHighlight: true
});
  1. Localized date picker:
$.fn.datepicker.dates['fr'] = {
    days: ["Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi"],
    daysShort: ["Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam"],
    daysMin: ["Di", "Lu", "Ma", "Me", "Je", "Ve", "Sa"],
    months: ["Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"],
    monthsShort: ["Jan", "Fév", "Mar", "Avr", "Mai", "Jun", "Jul", "Aoû", "Sep", "Oct", "Nov", "Déc"],
    today: "Aujourd'hui",
    clear: "Effacer",
    format: "dd/mm/yyyy",
    titleFormat: "MM yyyy",
    weekStart: 1
};

$('#datepicker-fr').datepicker({
    language: 'fr'
});

Getting Started

  1. Include Bootstrap CSS and JS files in your HTML.
  2. Include jQuery and the bootstrap-datepicker JS and CSS files:
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.9.0/css/bootstrap-datepicker.min.css">
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.9.0/js/bootstrap-datepicker.min.js"></script>
  1. Initialize the date picker on your input element:
$('#my-datepicker').datepicker({
    format: 'yyyy-mm-dd',
    autoclose: true
});

Competitor Comparisons

16,122

lightweight, powerful javascript datetimepicker with no dependencies

Pros of flatpickr

  • Lightweight and dependency-free
  • Supports a wide range of date and time formats
  • Highly customizable with extensive theming options

Cons of flatpickr

  • Less integrated with Bootstrap styling
  • Steeper learning curve for advanced customizations
  • Smaller community compared to Bootstrap Datepicker

Code Comparison

bootstrap-datepicker:

$('#datepicker').datepicker({
    format: 'mm/dd/yyyy',
    startDate: '-3d'
});

flatpickr:

flatpickr("#datepicker", {
    dateFormat: "m/d/Y",
    minDate: "today",
    maxDate: new Date().fp_incr(14)
});

Both libraries offer similar basic functionality, but flatpickr provides more built-in options for date ranges and formatting. Bootstrap Datepicker relies more on Bootstrap's styling, while flatpickr offers more flexibility in terms of appearance and customization.

flatpickr is generally considered more modern and feature-rich, but Bootstrap Datepicker may be easier to integrate into existing Bootstrap projects. The choice between the two often depends on specific project requirements and the developer's familiarity with each library.

8,000

A refreshing JavaScript Datepicker — lightweight, no dependencies, modular CSS

Pros of Pikaday

  • Lightweight and dependency-free, making it easier to integrate into various projects
  • Highly customizable with extensive theming options
  • Better support for mobile devices and touch interfaces

Cons of Pikaday

  • Less extensive documentation compared to Bootstrap Datepicker
  • Smaller community and fewer contributors, potentially leading to slower updates
  • Lacks some advanced features present in Bootstrap Datepicker, such as range selection

Code Comparison

Bootstrap Datepicker:

$('#datepicker').datepicker({
    format: 'mm/dd/yyyy',
    startDate: '-3d'
});

Pikaday:

var picker = new Pikaday({
    field: document.getElementById('datepicker'),
    format: 'MM/DD/YYYY',
    minDate: new Date(new Date().setDate(new Date().getDate() - 3))
});

Both libraries offer similar functionality for basic date picking, but their initialization and configuration syntax differ. Bootstrap Datepicker uses jQuery and follows a more traditional plugin-style initialization, while Pikaday uses vanilla JavaScript and a more modern object-oriented approach.

JavaScript Date Range, Date and Time Picker Component

Pros of daterangepicker

  • Supports selecting date ranges, not just single dates
  • Includes time picker functionality
  • More modern UI with customizable themes

Cons of daterangepicker

  • Larger file size and potentially more complex to implement
  • Less extensive documentation compared to bootstrap-datepicker
  • May have a steeper learning curve for beginners

Code Comparison

bootstrap-datepicker:

$('#datepicker').datepicker({
    format: 'mm/dd/yyyy',
    startDate: '-3d'
});

daterangepicker:

$('input[name="daterange"]').daterangepicker({
    startDate: moment().subtract(3, 'days'),
    endDate: moment(),
    locale: {
        format: 'MM/DD/YYYY'
    }
});

Both libraries offer easy-to-use initialization, but daterangepicker provides more built-in options for selecting date ranges and handling time. bootstrap-datepicker focuses on single date selection with a simpler API, while daterangepicker offers more advanced features out of the box. The choice between the two depends on the specific requirements of your project, such as the need for date ranges, time selection, and UI preferences.

⚠️ [Deprecated] No longer maintained. A simple jQuery datepicker plugin.

Pros of datepicker

  • Lightweight and dependency-free, making it easier to integrate into various projects
  • Supports a wide range of date formats and locales out of the box
  • Offers more customization options for appearance and behavior

Cons of datepicker

  • Less extensive documentation compared to bootstrap-datepicker
  • Smaller community and fewer third-party extensions available
  • May require more manual styling to match specific design requirements

Code Comparison

bootstrap-datepicker:

$('#datepicker').datepicker({
    format: 'mm/dd/yyyy',
    startDate: '-3d'
});

datepicker:

const picker = new Datepicker(document.getElementById('datepicker'), {
    format: 'mm/dd/yyyy',
    startDate: new Date(Date.now() - 3 * 24 * 60 * 60 * 1000)
});

Both libraries offer similar functionality, but datepicker provides a more modern, vanilla JavaScript approach. The bootstrap-datepicker relies on jQuery, while datepicker is a standalone solution. The syntax for initialization and option setting differs slightly, with datepicker using a more object-oriented approach.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

bootstrap-datepicker

Join the chat at https://gitter.im/uxsolutions/bootstrap-datepicker Build Status GitHub license npm Twitter Follow

Versions are incremented according to semver.

CDN

You can use the CloudFlare powered cdnjs.com on your website.

bootstrap-datepicker on cdnjs

Please note: It might take a few hours until a new version is available on cdnjs.

Links

Snippets

Development

Once you cloned the repo, you'll need to install grunt and the development dependencies using a package manager:

  • yarn (recommended):
$ [sudo] yarn global add grunt-cli
$ yarn install
$ [sudo] npm install --global grunt-cli
$ npm install

NPM DownloadsLast 30 Days