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

jalali-persian-datepicker

v1.1.11

Published

A custom Jalali date picker for Next.js and React.js

Downloads

435

Readme

Jalali Persian DatePicker

A customizable Jalali (Persian) date picker component for React and Next.js, allowing users to easily select dates in the Jalali calendar. This package leverages jalaali-js for Jalali date conversion and @radix-ui/react-popover for the date picker UI, while letting users install external dependencies themselves for flexibility.

[!TIP] This package works best with Shadcn/ui if you installed that you don't need to install anything except jalaali-js and popover from Shadcn/ui

Demo

Demo Picture

Features

  • Jalali (Persian) calendar functionality.
  • Designed for use with React and Next.js.
  • Fully customizable and easy to integrate.
  • External dependencies are lightweight and user-managed.
  • Allows flexible usage with UI libraries like Radix and Shadcn/UI.

Installation

To use this package, you’ll need to install both the Jalali Persian DatePicker and its peer dependencies.

Step 1: Install the Package

npm install jalali-persian-datepicker jalaali-js

Step 2: Install Peer Dependencies

npm install @radix-ui/react-popover lucide-react

Usage

Here’s a basic example of how to use the Jalali Persian DatePicker component in a React or Next.js project:

Example

import React, { useState } from "react";
import { JalaliPersianDatePicker } from "jalali-persian-datepicker";
import {
  Popover,
  PopoverTrigger,
  PopoverContent,
} from "@radix-ui/react-popover";
import { Button } from "shadcn/ui";

const MyComponent = () => {
  const [selectedDate, setSelectedDate] = useState(null);

  return (
    <div>
      <JalaliPersianDatePicker
        selected={selectedDate}
        onSelect={(date) => setSelectedDate(date)}
      />
    </div>
  );
};

export default MyComponent;

Available Props

| Prop | Type | Description | | ---------- | ----------------------------- | -------------------------------------------------------------------------------- | | selected | JalaaliDate | undefined | The currently selected date in the Jalali calendar. Format: { jy, jm, jd } | | onSelect | (date: JalaaliDate) => void | Callback triggered when a user selects a date. Returns the selected Jalali date. |

Dependencies

This package relies on the following peer dependencies, which you must install:

License

This project is licensed under the MIT License.

You are free to use, modify, and distribute this software. See the LICENSE file for more details.