Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

datepickr

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

datepickr

A do it yourself Date picker.

  • 1.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
631
decreased by-2.17%
Maintainers
1
Weekly downloads
 
Created
Source

Datepickr

The do it yourself date picker. It makes as no assumptions how it's shown on the page. See demo.

  • Need to show/hide it on an input field? Do it yourself.
  • Need to have it insert one date after selection? Do it yourself.
  • Need nice formatted dates after selection? Do it yourself.

Usage

<div id='datepickr'></div>

<script>
    var el = document.getElementById('datepickr');
    new Datepickr(el, function(res) {
       // console.log(res);
    });
</script>

API

new Datepickr(element, callback, options);

The callback returns an array of arrayed dates whenever a date is selected.

[
    [1412481600000,1],
    [1413864000000,1],
    [1413950400000,1],
    [1414468800000,1]
]

The first field value is a timestamp along with 1 or 0.5 depending on whether halfdays are enabled as an option or not.

OptionDefault ValueDescription
weekdaysAn array of weekday strings in EnglishOption for translation
monthsAn array of month strings in EnglishOption for translation
startYearCurrent yearStart the date picker on a particular year
startMonthCurrent monthStart the date picker on a particular month
minDatenulla timestamp representing a maximum date the pager should page
maxDatenulla timestamp representing a minimum date the pager should page
halfDayfalseEnables halfday selection of dates
omitPastfalsePrevent selecting days in the past
omitFuturefalsePrevent selecting days in the future
omitWeekendsfalsePrevent selecting weekends
omitDaysEmpty arrayPass a timestamp array of dates to prevent the selection of
activeDaysEmpty arrayPass an array of arrayed dates ie. [[[1413950400000,1],[1414468800000,0.5] that are auto selected on load

To see examples of each option see the demos.

Adding/Removing options after initialization.

var pickr = new Datepickr(el);
pickr.options({
    halfDay: true
});

Use with node or browserify.

// npm install datepickr
var datepickr = require('datepickr')

datepickr(el, function(res) {
  console.log(res);
});

Credits

Code originally based off of datepickr.

Keywords

FAQs

Package last updated on 04 Dec 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc