Bootstrap Datetimepicker (tarruda fork)
raw JSON →This package is a fork of the original `bootstrap-datepicker` by Stefan Petre, extended to provide both date and time picking functionality for Twitter Bootstrap. Originally designed for Bootstrap 2 and 3, it integrates as a jQuery plugin, allowing users to select dates and times through a unified UI. The `tarruda` fork, specifically the one requested, reached versions like `0.0.7` and `0.0.10` and explicitly states it is no longer maintained, with its GitHub repository marked as archived. It differentiated itself by adding crucial time selection (hours, minutes) to the date-only functionality of its parent project. Developers seeking similar functionality for modern Bootstrap versions should look for actively maintained alternatives like `eonasdan/bootstrap-datetimepicker` or the non-Bootstrap-specific `@eonasdan/tempus-dominus`. The original package's release cadence was infrequent and it is now abandoned.
Common errors
error TypeError: $(...).datetimepicker is not a function ↓
bootstrap-datetimepicker.min.js. Verify paths are correct and files are accessible. error Date picker displays incorrectly or has missing styles. ↓
bootstrap.min.css and bootstrap-datetimepicker.min.css are correctly linked in the <head> section of your HTML and that their paths are valid. Ensure the Bootstrap version matches what the datetimepicker was designed for (typically Bootstrap 2 or 3). error Input mask not working or date/time format is not applied. ↓
data-format="dd/MM/yyyy hh:mm:ss" attribute on your input element, or pass a format option during initialization. If using moment.js (common in related forks), ensure its locale settings are correctly applied if using non-English formats. Warnings
breaking This package is explicitly marked as abandoned and is no longer maintained. Using it in new projects is strongly discouraged due to lack of updates, potential security vulnerabilities, and incompatibility with modern web standards. ↓
breaking The `tarruda/bootstrap-datetimepicker` fork is compatible primarily with Bootstrap 2 and 3. It will not work correctly, and likely break styling and functionality, with Bootstrap 4, 5, or newer versions due to significant changes in Bootstrap's CSS and JavaScript APIs. ↓
gotcha This plugin relies on specific versions of jQuery. Using it with very old or very new versions of jQuery might lead to unexpected behavior or breakage, as jQuery's API has evolved over time. ↓
gotcha The documentation for this specific fork is hosted on GitHub Pages and is no longer actively maintained. Finding accurate, complete, and up-to-date usage information can be challenging. ↓
Install
npm install bootstrap-datetimepicker yarn add bootstrap-datetimepicker pnpm add bootstrap-datetimepicker Imports
- $().datetimepicker wrong
import { datetimepicker } from 'bootstrap-datetimepicker';correct<!-- Include jQuery, Bootstrap, and plugin JS files --> <script src="path/to/jquery.min.js"></script> <script src="path/to/bootstrap.min.js"></script> <script src="path/to/bootstrap-datetimepicker.min.js"></script> <script> $(function() { $('#myDatetimepicker').datetimepicker(); }); </script> - datetimepicker CSS wrong
import 'bootstrap-datetimepicker/css/bootstrap-datetimepicker.css';correct<!-- In <head> --> <link href="path/to/bootstrap.min.css" rel="stylesheet"> <link href="path/to/bootstrap-datetimepicker.min.css" rel="stylesheet"> - $.fn.datetimepicker.defaults
<script> $.fn.datetimepicker.defaults.maskInput = false; $('#myDatetimepicker').datetimepicker(); </script>
Quickstart
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Bootstrap Datetimepicker Demo</title>
<!-- Bootstrap 2 or 3 CSS - adjust path as needed -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<!-- Bootstrap Datetimepicker CSS - adjust path as needed -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.37/css/bootstrap-datetimepicker.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
<h1>Bootstrap Datetimepicker (tarruda fork)</h1>
<div class="form-group">
<label for="datetimepickerInput">Select Date and Time:</label>
<div class="input-group date" id="datetimepicker1">
<input type="text" class="form-control" id="datetimepickerInput" data-format="dd/MM/yyyy hh:mm:ss PP"/>
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
</div>
<!-- jQuery - adjust path as needed -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<!-- Moment.js is often required by later forks/versions for advanced parsing/formatting -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js"></script>
<!-- Bootstrap JS - adjust path as needed -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
<!-- Bootstrap Datetimepicker JS - adjust path as needed -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.37/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript">
$(function () {
// Global defaults can be set here if desired
// $.fn.datetimepicker.defaults.language = 'en';
// Initialize the datetimepicker
$('#datetimepicker1').datetimepicker({
// Example options (refer to original documentation for full list)
pickDate: true, // Enable date picker
pickTime: true, // Enable time picker
maskInput: true, // Use masked input (default for this fork)
pickSeconds: true, // Enable seconds selection
showTodayButton: true,
language: 'en' // Ensure language is set if locales are included
});
// Example of getting selected date
$('#datetimepicker1').on('dp.change', function (e) {
console.log('Selected date:', e.date.format('YYYY-MM-DD HH:mm:ss'));
});
});
</script>
</body>
</html>