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

@quoin/nepali-datepicker-reactjs

v1.2.4

Published

Nepali Datepicker Reactjs

Downloads

275

Readme

@sbmdkl/nepali-datepicker-reactjs

NPM JavaScript Style Guide

A simple and reusable Datepicker component for React Read Full Documentation.

Installation

npm install @sbmdkl/nepali-datepicker-reactjs

default blue dark red deepdark green

Usage

//Class Component
import React from 'react';

import Calendar from '@sbmdkl/nepali-datepicker-reactjs';
import '@sbmdkl/nepali-datepicker-reactjs/dist/index.css';

class App extends React.Component {
	state = { date: '' };

	onChange = ({ bsDate, adDate }) => {
		this.setState({ date: bsDate });
	};

	render() {
		return (
			<div>
				<Calendar onChange={this.onChange} />
			</div>
		);
	}
}

export default App;
//Functional Component
import React, { useState } from 'react';

import Calendar from '@sbmdkl/nepali-datepicker-reactjs';
import '@sbmdkl/nepali-datepicker-reactjs/dist/index.css';

function App() {
	const [date, setDate] = useState('');

	const handleDate = ({ bsDate, adDate }) => {
		setDate({ date: bsDate });
	};
	return (
		<div>
			<h1>Nepali Date Picker for React</h1>
			<Calendar onChange={handleDate} theme='deepdark' />
		</div>
	);
}

export default App;

User guide

Props

| Prop name | Description | Default value | Example values | | ----------- | ------------------------------------------------------------------------------------------------------------------------------------- | ------------- | ------------------------------------------ | | className | Custom class to input field of calendar. | n/a | 'form-control' | | defaultDate | Default date to start the calendar. Date format must be YYYY-MM-DD and in english number | n/a | "YYYY/MM/DD" | | dateFormat | Input Date Format. Supported values are: YYYY,YYY,YY, M, MM, MMMM, D, DD, DDD, DDDD. | YYYY-MM-DD | "YYYY/MM/DD" | | language | Language options are: en or ne. Shows the calendar in different language. | ne | "ne" | | minDate | Mininum date, below minimum date (included) all dates are disabled. Date format must be YYYY-MM-DD and in english number | n/a | "2077-10-20" | | maxDate | Maximum date, above maximum date (included) all dates are disabled. Date format must be YYYY-MM-DD and in english number | n/a | "2077-12-05" | | onChange | Function called when the user clicks an item on the most detailed view available. Returns both selected nepali date and english date. | n/a | (value) => alert('New date is: ', value) | | style | Custom style to input field of calendar. | n/a | {{color:'red'}} | | theme | Use multi theme availabe by defaults. Theme supports : red blue green dark deepdark default. | default | "red" | | hideDefaultValue | hide initial date value in the input | false | true | | placeholder | Your custom placeholder | n/a | "Select Date" |

dateFormat

Format the date to provide various output based on format string

Date Format output will auto change with the language. If language is set to english en, then YYYY will shows 2077, 2078 ..., similarily output of DDDD will shows Sunday, Monday ...

dateFormat Usage

<Calendar onChange={this.onChange} dateFormat='DDDD, YYYY-MM-DD' />

output: सोमवार, २०७७-११-०३

<Calendar onChange={this.onChange} dateFormat='DDDD, MMMM DD, YYYY' />

output: शुक्रवार, फाल्गुन १४, २०७७

<Calendar onChange={this.onChange} language='en' dateFormat='DDDD, MMMM DD, YYYY' />

output: Friday, Falgun 14, 2077

Get Ad date of selected Date

// both Ad and BS dates are passed to onChange on each date selected
onChange = ({ bsDate, adDate }) => {
	this.setState({ date: bsDate });
};

Using with language and theme

import React from 'react';

import Calendar from '@sbmdkl/nepali-datepicker-reactjs';
import '@sbmdkl/nepali-datepicker-reactjs/dist/index.css';

class App extends React.Component {
	state = { date: '' };

	onChange = ({ bsDate, adDate }) => {
		this.setState({ date: bsDate });
	};

	render() {
		return (
			<div>
				<Calendar
					onChange={this.onChange}
					language='en'
					theme='deepdark'
					dateFormat='DDDD, YYYY-MM-DD'
				/>
			</div>
		);
	}
}

export default App;

Output:

output

License

MIT © Shubham Dhakal