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 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-jdp

v0.4.3

Published

Jalaali Datepicker component for React applications

Downloads

98

Readme

React-Jdp

React-Jdp is an open source Jalaali date picker component for React.

demo.png

Installation

$ npm install react-jdp

or using yarn

$ yarn add react-jdp

Loading stlyesheets

Don't forget to import Jdp css or scss filse into your project

css file can be found in: node_modules\react-jdp\css\jdp.css

scss file can be found in: node_modeuls\react-jdp\styles\jdp.scss

If you choose to use scss, you need to compile it to css before publishing your project to the web

Example of use

Import jdp into your page

import Jdp from 'react-jdp'

Place Jdp component whereever you want

<Jdp
  show={this.state.showJdp}
  parent={this.jdpToggleBtn}
  onHide={() => {this.setState({showJdp: false})}}
  onPick={date => {console.log(date)}}
/>

Options

Option | Default | Description
------------------|-------------------|-------------------------------------------------------------------------------------------- show | false (required) | boolean variable indicates Jdp is visible or not
parent | -- (required) | html element that Jdp position binds to onHide | (required) | the function used to hide Jdp. Should change passed show variable to false onPick | (required) | the function get called when user pick a date type | jalaali | indicates date picker type. value can be jalaali or gregorian size | md | the size of Jdp, sm for small, md for medium and lg for large placement | bottom | which placement of parent, Jdp should shown. chooose one of top, right, bottom & left animated | true | true value enables usings fadeIn, fadeOut and slide transitions year | -- | calendar start year month | -- | calendar start month day | -- | calendar start day current | -- | an object of {day, month, day} that indicates current selected date format | yyyy/mm/dd | string format of returned date on onPick method highlightWeekends | true | show weekend days with another color shape | 'rectangle' | indicates how Jdp should like. in reactanle mode Jdp will be wide and in square Jdp will be like an square

Options.parent

For definating parent you can use ref or id. Here is two sample code

using ref

<button ref={ref => {this.jdpToggleBtn = ref}} >
  ...
</button>

using id

<button id="jdpToggleBtn">
  ...
</button>

Options.onPick

When user click on a day on calendar or click on today button this method will be called. The date passed variable is an object, with both Jalaali and Gregorian values of selected day. Both Jalaali and Gregorian are objects contains year, month and day value. For ease of use, formatted string of selected date passed too. Their named as jalaaliString and gregorianString. You can change the format of date strign by passing an string prop as format

Sample date callback result

{
  jalaali: {year: 1396, month: 11, day: 15},
  gregorian: {yaer: 2018, month: 2, day: 4},
  jalaaliString: '1396/11/15',
  gregorianString: '2018/02/04'
}

Options.shape

Sets how datepicker should be like. in rectangle datepicker will be wide rectangle, but in square datepicker will be close to an square, not a shape with equal width and height

Options.size

Sets datepicker width based on the following table values.

in rectangle shaped datepicker:

Size | Width --------|-------- sm | 250px md | 350px lg | 450px

in square shaped datepicker:

Size | Width --------|-------- sm | 220px md | 260px lg | 310px

Options.placement

Sets in which side on parent element, Jdp should be shown. Jdp automaticaly checks enough space around the element before showing datepicker. So if you choose top, right or left and on the render time, there was't enough space on selected side of parent element, Jdp chande position to bottom and show datepicker beneath the element

Options.highlightWeekends

With true value, weekends (based on type of datepicker) will be shown with another color. In current version this color is red