Top Related Projects
lightweight, powerful javascript datetimepicker with no dependencies
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
- Basic date picker initialization:
$('#datepicker').datepicker({
format: 'mm/dd/yyyy',
startDate: '-3d'
});
- Date range selection:
$('#date-range').datepicker({
inputs: $('.date-range-input'),
format: 'yyyy-mm-dd'
});
- Inline calendar display:
$('#inline-calendar').datepicker({
calendarWeeks: true,
todayHighlight: true
});
- 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
- Include Bootstrap CSS and JS files in your HTML.
- 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>
- Initialize the date picker on your input element:
$('#my-datepicker').datepicker({
format: 'yyyy-mm-dd',
autoclose: true
});
Competitor Comparisons
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.
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 designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
bootstrap-datepicker
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
- Online Demo
- Online Docs (ReadTheDocs.com)
- Google Group
- Travis CI
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
- npm:
$ [sudo] npm install --global grunt-cli
$ npm install
Top Related Projects
lightweight, powerful javascript datetimepicker with no dependencies
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.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot