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 🙏

© 2025 – Pkg Stats / Ryan Hefner

antd-date-picker-nepali

v0.1.2

Published

This is a antd component for nepali datepicker.

Readme

Nepali Date Picker

A TypeScript-based date picker that supports both Gregorian (AD) and Nepali (BS) calendars, built on top of Ant Design for react.

Table of Contents

Installation

npm install antd-date-picker-nepali

Features

  • Convert AD dates to BS (Nepali) dates and vice versa
  • Validate Nepali dates
  • Get weekday information
  • Get days in Nepali months
  • Type-safe with TypeScript support

Usage

Basic Usage

import NepaliDateConverter from "antd-date-picker-nepali";

// Get today's date in Nepali calendar
const todayNepali = NepaliDateConverter.getTodayBs();

Then, you can use the Nepali date picker component in your React project as follows:

import React from 'react';
import { NepaliDatePicker } from 'antd-date-picker-nepali';
import 'antd/dist/antd.css';

const App = () => {
  const onChange = (date: any, dateString: string) => {
    console.log(date, dateString);
  };

  return (
    <div>
      <h1>Nepali Date Picker</h1>
      <NepaliDatePicker onChange={onChange} />
    </div>
  );
};

export default App;

Components

NepaliDatePicker

The NepaliDatePicker component supports all the same props as the Ant Design DatePicker component. Please refer to the Ant Design DatePicker documentation for detailed information.

Here is an example of how to use the NepaliDatePicker component with additional props:

import React from 'react';
import { NepaliDatePicker } from 'antd-date-picker-nepali';
import 'antd/dist/antd.css';

const App = () => {
  const onChange = (date: any, dateString: string) => {
    console.log(date, dateString);
  };

  return (
    <div>
      <h1>Nepali Date Picker</h1>
      <NepaliDatePicker
        onChange={onChange}
        placeholder="Select date"
        format="YYYY-MM-DD"
        showToday
      />
    </div>
  );
};

export default App;

NepaliRangePicker

The NepaliRangePicker component supports all the same props as the Ant Design RangePicker component. Please refer to the Ant Design RangePicker documentation for detailed information.

Here is an example of how to use the NepaliRangePicker component with additional props:

import React from 'react';
import { NepaliRangePicker } from 'antd-date-picker-nepali';
import 'antd/dist/antd.css';

const App = () => {
  const onChange = (dates: any, dateStrings: [string, string]) => {
    console.log(dates, dateStrings);
  };

  return (
    <div>
      <h1>Nepali Range Picker</h1>
      <NepaliRangePicker
        onChange={onChange}
        placeholder={['Start date', 'End date']}
        format="YYYY-MM-DD"
        showTime
      />
    </div>
  );
};

export default App;

API Reference

Component Props

Both components support all standard Ant Design DatePicker props plus these additional props:

| Prop | Type | Default | Description | | ---- | ---------------- | ------- | ------------------------ | | type | "ne" | "en" | "en" | Calendar type to display | | lang | "ne" | "en" | "en" | Calendar languange type |

NepaliDateConverter Methods

Static methods for converting and managing Nepali dates.

Methods

validateBsDate(bsDate: NepaliDateType): boolean

Validates if a given Nepali date is valid.

const date = { year: 2080, month: 13, day: 1 };
const isValid = NepaliDateConverter.validateBsDate(date); // false (invalid month)
getTodayBs(): NepaliDateType

Returns today's date in Nepali calendar.

const today = NepaliDateConverter.getTodayBs();
getWeekDay(bsDate: NepaliDateType): number

Returns the day of week (0 = Sunday, 6 = Saturday) for a given Nepali date.

const weekday = NepaliDateConverter.getWeekDay({
  year: 2080,
  month: 1,
  day: 1,
});
adToBs(adDate: Dayjs | Date | string): NepaliDateType

Converts an AD date to BS (Nepali) date.

const nepaliDate = NepaliDateConverter.adToBs(new Date());
// or
const nepaliDate = NepaliDateConverter.adToBs("2023-08-15");
bsToAd(bsDate: NepaliDateType): Dayjs

Converts a BS (Nepali) date to AD date.

const adDate = NepaliDateConverter.bsToAd({
  year: 2080,
  month: 8,
  day: 15,
});
getNepaliDate(adDate: Date): NepaliDateType

Convenience method to get Nepali date from AD date.

const nepaliDate = NepaliDateConverter.getNepaliDate(new Date());
getEnglishDate(npYear: number, npMonth: number, npDay: number): Date

Convenience method to get AD date from Nepali date components.

const adDate = NepaliDateConverter.getEnglishDate(2080, 8, 15);
getDaysInMonth(year: number, month: number): number

Returns the number of days in a given Nepali month.

const days = NepaliDateConverter.getDaysInMonth(2080, 8);

Types

NepaliDateType

interface NepaliDateType {
  year: number;
  month: number;
  day: number;
}

Contributing

If you want to contribute to this project, please follow these steps:

  • Fork the repository.
  • Create a new branch (git checkout -b feature-branch).
  • Make your changes and commit them (git commit -am 'Add new feature').
  • Push to the branch (git push origin feature-branch).
  • Create a new Pull Request.

License

This project is licensed under the MIT License.