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

drm-datepickerjs

v1.0.3

Published

An headless, event-base picker for JavaScript and any JavaScript base library/framework written in typescript, supports for DatePicker, RangePicker, MultiSelectPicker.

Downloads

610

Readme

drm-datepickerjs

An headless, event-base, picker for Javascript project, with customization and localization support. This package provides your core functionality to create any picker your want, it does't matter which design system you use for UI and how much you need customization. This package provides you with 3 different of pickers

  • DatePicker
    • used for simple date selection like birthday
  • RangePicker
    • used to select a range of date
  • MultiSelectPicker
    • used to randomly select dates (also range selection and de-selection is available)

Introduction

This package created in order to work regardless which tool you use, for example it doesn't matter you use a style system or write your style in pure css, it doesn't matter you use one of the existing JS framework or use a custom framework that you created by your own, still possible to use this package, also if you using pure js it's possible to use CDN (check this), even possible to use require instead of import (.cjs file included).

With this package you can add your localization easily, and it's up to you to determine the switch condition. localization doc

This package use JS new Date() to create dates and stores date based on gregorian calendar, this gives you more flexibility for example you can show one calendar as your primary calendar and show others calendar by only create a helper function that convert gregorian date to your target calendar, passing date to this converter gives you converted date, then you can do whatever you want with this date.

Because of headless design you can use this package to create calendars too.

Features

  • Headless UI
  • Framework/library independent
  • Easy localization
  • Event base Picker
  • Support leap year
  • Zero dependency
  • Supports cjs (common js, for Node.js environment, i.e require - module.exports)
  • Low bundle size (for ES Module, without trees shaking entire package bundle size (gzip) equals to ~4KB).
  • Supports Type (the entire package written with Typescript)
  • Available Pickers: DatePicker, RangePicker, MultiSelectPicker

You can create your custom event and show it anywhere you want (check this). Also with MultiSelectPicker you can select range of dates by holding ctrlKey, and de-select dates by holding shiftKey. (see customization for more info)

How This Package Works

By adding this package you have access to 3 different types of pickers, you can change the behavior of the picker by passing some flags to the picker constructor (for more info read Customization), then picker instance gives you the functionality you need to create any picker you want, and it is you who decides to use all or some of these functions. In picker instance there is 2 more functions that I want to mention, changeDay and onChangeDate.

  • The changeDay function can change the selected date, and this is the handler that must be called when user want to click/tap on a date.
  • The onChangeDate takes a callback as an argument and runs it after user click/tap a button in order to change the date. Check the documentation about other functions doc.

Notes

  • make sure the picker instance remain the same on each renders.

Installation

npm i drm-datepickerjs
yarn add drm-datepickerjs
pnpm i drm-datepickerjs

Documentation Links

There is more to this package recommend to read following documentations.