npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

datepickr

v1.4.2

Published

A do it yourself Date picker.

Downloads

1,996

Readme

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.

| Option | Default Value | Description | | ---- | ---- | ---- | | weekdays | An array of weekday strings in English | Option for translation | | months | An array of month strings in English | Option for translation | | startYear | Current year | Start the date picker on a particular year | | startMonth | Current month | Start the date picker on a particular month | | minDate | null | a timestamp representing a maximum date the pager should page | | maxDate | null | a timestamp representing a minimum date the pager should page | | halfDay | false | Enables halfday selection of dates | | omitPast | false | Prevent selecting days in the past | | omitFuture | false | Prevent selecting days in the future | | omitWeekends | false | Prevent selecting weekends | | omitDays | Empty array | Pass a timestamp array of dates to prevent the selection of | | activeDays | Empty array | Pass an array of arrayed dates ie. [[[1413950400000,1],[1414468800000,0.5] that are auto selected on load | | utc | false | Should date output be interpreted as UTC | | singleSelection | false | Limit days selection to one day. |

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);
});

Developing

npm install && npm start

Building

npm run build

Credits

Code originally based off of datepickr.