Convert Figma logo to code with AI

xdan logodatetimepicker

jQuery Plugin Date and Time Picker

3,497
1,516
3,497
431

Top Related Projects

16,122

lightweight, powerful javascript datetimepicker with no dependencies

8,000

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

A datepicker for twitter bootstrap (@twbs)

JavaScript Date Range, Date and Time Picker Component

Quick Overview

xdan/datetimepicker is a jQuery plugin that provides a customizable and user-friendly date and time picker for web applications. It offers a wide range of options for formatting, localization, and styling, making it suitable for various use cases and international projects.

Pros

  • Easy to implement and integrate with existing jQuery-based projects
  • Highly customizable with numerous options for appearance and behavior
  • Supports multiple languages and date/time formats
  • Responsive design, works well on both desktop and mobile devices

Cons

  • Requires jQuery, which may not be ideal for modern projects moving away from jQuery
  • Limited native TypeScript support
  • Some users report occasional bugs with specific date formats or timezones
  • Documentation could be more comprehensive and better organized

Code Examples

  1. Basic implementation:
$('#datetimepicker').datetimepicker();

This code initializes a basic date and time picker on an input element with the ID 'datetimepicker'.

  1. Customizing format and language:
$('#datetimepicker').datetimepicker({
  format: 'Y-m-d H:i',
  lang: 'fr'
});

This example sets a custom date/time format and changes the language to French.

  1. Setting min/max dates and disabling specific dates:
$('#datetimepicker').datetimepicker({
  minDate: '2023-01-01',
  maxDate: '2023-12-31',
  disabledDates: ['2023-07-04', '2023-12-25'],
  timepicker: false
});

This code sets a date range, disables specific dates, and turns off the time picker functionality.

Getting Started

  1. Include jQuery and the datetimepicker files in your HTML:
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<link rel="stylesheet" href="jquery.datetimepicker.min.css">
<script src="jquery.datetimepicker.full.min.js"></script>
  1. Initialize the datetimepicker on your input element:
$(document).ready(function() {
  $('#datetimepicker').datetimepicker();
});
  1. Customize the picker as needed using the available options:
$('#datetimepicker').datetimepicker({
  format: 'Y-m-d H:i',
  step: 30,
  dayOfWeekStart: 1,
  minDate: 0
});

This example sets a custom format, 30-minute time steps, starts the week on Monday, and sets the minimum date to today.

Competitor Comparisons

16,122

lightweight, powerful javascript datetimepicker with no dependencies

Pros of flatpickr

  • Lightweight and dependency-free
  • Extensive customization options and plugins
  • Better cross-browser compatibility

Cons of flatpickr

  • Steeper learning curve for advanced features
  • Less intuitive for simple use cases

Code Comparison

flatpickr:

flatpickr("#myDatePicker", {
  enableTime: true,
  dateFormat: "Y-m-d H:i",
  minDate: "today"
});

datetimepicker:

jQuery('#myDatePicker').datetimepicker({
  format: 'Y-m-d H:i',
  minDate: 0
});

Key Differences

  • flatpickr is a standalone library, while datetimepicker requires jQuery
  • flatpickr offers more modern features and a wider range of customization options
  • datetimepicker has a simpler API for basic use cases

Performance

flatpickr generally performs better due to its lightweight nature and lack of dependencies. It has a smaller file size and faster load times compared to datetimepicker.

Community and Maintenance

Both projects have active communities, but flatpickr has seen more recent updates and contributions. It also has a larger user base and more frequent releases.

Conclusion

Choose flatpickr for modern, lightweight, and highly customizable date/time picking functionality. Opt for datetimepicker if you prefer a simpler API and are already using jQuery in your project.

8,000

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

Pros of Pikaday

  • Lightweight and dependency-free
  • Highly customizable with extensive theming options
  • Better cross-browser compatibility, including older browsers

Cons of Pikaday

  • Less feature-rich compared to datetimepicker
  • Requires more manual configuration for advanced use cases
  • Limited built-in localization support

Code Comparison

datetimepicker:

$('#datetimepicker').datetimepicker({
  format: 'Y-m-d H:i',
  inline: true,
  lang: 'en'
});

Pikaday:

var picker = new Pikaday({
  field: document.getElementById('datepicker'),
  format: 'YYYY-MM-DD',
  onSelect: function(date) {
    console.log(date);
  }
});

Both libraries offer simple initialization, but datetimepicker provides more built-in options like inline display and language selection. Pikaday requires additional configuration for similar functionality but offers more flexibility in terms of customization and integration with other libraries or frameworks.

A datepicker for twitter bootstrap (@twbs)

Pros of bootstrap-datepicker

  • Better integration with Bootstrap framework
  • More extensive documentation and examples
  • Wider range of customization options for appearance and behavior

Cons of bootstrap-datepicker

  • Larger file size, potentially impacting page load times
  • Steeper learning curve due to more complex configuration options
  • Less frequent updates and maintenance compared to datetimepicker

Code Comparison

bootstrap-datepicker:

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

datetimepicker:

$('#datetimepicker').datetimepicker({
    format: 'd/m/Y H:i',
    minDate: '-1970/01/02',
    allowTimes: ['12:00', '13:00', '15:00']
});

Both libraries offer similar functionality for date and time selection, but bootstrap-datepicker focuses more on date-only selection with Bootstrap-specific styling. datetimepicker provides a more compact solution for both date and time selection with a wider range of formatting options.

The choice between these libraries depends on your specific project requirements, such as Bootstrap integration, date/time selection needs, and desired customization level.

JavaScript Date Range, Date and Time Picker Component

Pros of daterangepicker

  • Supports selecting date ranges, not just single dates
  • Offers more customization options and configurations
  • Includes time picker functionality

Cons of daterangepicker

  • Larger file size and potentially heavier performance impact
  • Steeper learning curve due to more complex API

Code Comparison

datetimepicker:

$('#datetimepicker').datetimepicker({
  format: 'Y-m-d H:i',
  inline: true
});

daterangepicker:

$('#daterangepicker').daterangepicker({
  timePicker: true,
  startDate: moment().startOf('hour'),
  endDate: moment().startOf('hour').add(32, 'hour'),
  locale: {
    format: 'YYYY-MM-DD HH:mm'
  }
});

Summary

Both datetimepicker and daterangepicker are popular date and time selection libraries for web applications. datetimepicker is simpler and more lightweight, focusing on single date selection with optional time picking. daterangepicker offers more advanced features, including date range selection and extensive customization options, but comes with a larger footprint and more complex usage. The choice between the two depends on the specific requirements of your project, such as the need for date range selection or the level of customization desired.

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

jQuery DateTimePicker

Demo and Documentation

Build Status npm version npm

PLEASE. Help me update the documentation. Doc.tpl This file will be automatically displayed on the site

Installation

npm install jquery-datetimepicker

OR

yarn add jquery-datetimepicker

or download zip

datetimepicker

==============

!!! In the latest version the 'lang' option is obsolete. The language setting is now global. !!!

Use this:

jQuery.datetimepicker.setLocale('en');

Documentation

jQuery Plugin Date and Time Picker

DateTimePicker

ScreenShot

DatePicker

ScreenShot

TimePicker

ScreenShot

Options to highlight individual dates or periods

ScreenShot

ScreenShot

ScreenShot

JS Build help

Requires Node and NPM Download and install node.js.

Install:

  1. Install bower globally with npm install -g bower.
  2. Run npm install. npm will look at package.json and automatically install the necessary dependencies.
  3. Run bower install, which installs front-end packages defined in bower.json.

Notice: If you use Bower v1.5.2, you will get the error: The "main" field cannot contain minified files You can regress to version 1.3.12

  1. npm uninstall bower -g
  2. npm install -g bower@1.3.12

Build:

First install npm requirements: npm install -g uglifycss concat-cli Then build the files: npm run build

When the build completes, you'll have the following files:

  • build/jquery.datetimepicker.full.js - browser file
  • build/jquery.datetimepicker.full.min.js - browser minified file
  • build/jquery.datetimepicker.min.js - amd module style minified file

NPM DownloadsLast 30 Days