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

hi-dtp

v1.19.2

Published

A modern Jalali (Persian) date and time picker component for React

Readme

HiDtp - Jalali (Persian) Date & Time Picker

A modern, customizable Jalali (Persian) date and time picker component for React applications. Built with TypeScript and designed for RTL (Right-to-Left) layouts.

Features

  • 🗓️ Jalali Calendar Support: Full Persian calendar implementation
  • Time Picker: 12/24 hour format with seconds support
  • 🎯 Multiple Selection Modes: Single, multiple, and range selection
  • ⌨️ Keyboard Navigation: Full keyboard accessibility
  • 🎨 Customizable Icons: Pass your own icon set
  • 📱 Responsive Design: Works on all screen sizes
  • 🎭 RTL Support: Built for Persian/Arabic layouts
  • 🔧 TypeScript: Full type safety
  • 🎨 Tailwind CSS: Styled with utility classes

Installation

npm install hi-dtp
# or
yarn add hi-dtp
# or
pnpm add hi-dtp

Basic Usage

import { JalaliDatePicker } from 'hi-dtp';

function App() {
  const [selectedDate, setSelectedDate] = useState(null);

  return (
    <JalaliDatePicker
      value={selectedDate}
      onChange={setSelectedDate}
      mode="single"
      placeholder="تاریخ را انتخاب کنید"
    />
  );
}

Advanced Usage

import { JalaliDatePicker } from 'hi-dtp';

function AdvancedExample() {
  const [selectedDates, setSelectedDates] = useState([]);

  return (
    <JalaliDatePicker
      value={selectedDates}
      onChange={setSelectedDates}
      mode="multiple"
      pickerType="dateAndClock"
      showTime={true}
      timeFormat24h={false}
      showSeconds={true}
      size="lg"
      enableKeyboardNavigation={true}
      disablePastDates={true}
      icons={{
        calendar: {
          src: '/path/to/calendar.svg',
          alt: 'Calendar Icon',
          width: 20,
          height: 20,
        },
      }}
    />
  );
}

Props

JalaliDatePickerProps

| Prop | Type | Default | Description | | -------------------------- | --------------------------------------------------- | ------------------------ | -------------------------- | | value | DatePickerValue | undefined | Selected date(s) | | onChange | (date: DatePickerValue, time?: TimeValue) => void | undefined | Change handler | | mode | 'single' \| 'multiple' \| 'range' | 'multiple' | Selection mode | | pickerType | 'date' \| 'clock' \| 'dateAndClock' | 'dateAndClock' | Picker type | | showTime | boolean | true | Show time picker | | timeFormat24h | boolean | false | Use 24-hour format | | showSeconds | boolean | false | Show seconds picker | | placeholder | string | 'تاریخ را انتخاب کنید' | Input placeholder | | disabled | boolean | false | Disable the picker | | disabledDates | JalaliDate[] | [] | Dates to disable | | disablePastDates | boolean | false | Disable past dates | | className | string | '' | Additional CSS classes | | size | 'sm' \| 'md' \| 'lg' | 'sm' | Component size | | enableKeyboardNavigation | boolean | false | Enable keyboard navigation | | onKeyDown | (event: KeyboardEvent) => void | undefined | Keyboard event handler | | icons | Partial<IconsObject> | defaultIcons | Custom icons |

Types

type DatePickerValue = JalaliDate | JalaliDate[] | { start: JalaliDate; end: JalaliDate } | null;

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

interface TimeValue {
  hour: number;
  minute: number;
  second: number;
}

interface IconsObject {
  calendar: IconProps;
  clear: IconProps;
  next: IconProps;
  previous: IconProps;
}

interface IconProps {
  src: string;
  alt: string;
  width: number;
  height: number;
}

Utility Functions

The package also exports useful utility functions:

import {
  getTodayJalali,
  formatJalaliDate,
  formatTime,
  toPersianDigits,
  toEnglishDigits,
  compareJalaliDates,
  isJalaliDateEqual,
  isDateBetween,
  getNextDate,
  getPrevDate,
  jalaliToGregorian,
  gregorianToJalali,
} from 'hi-dtp';

// Get today's Jalali date
const today = getTodayJalali();

// Format a Jalali date
const formatted = formatJalaliDate(today); // "۱۴۰۲/۱۲/۲۵"

// Convert to Persian digits
const persian = toPersianDigits('1402'); // "۱۴۰۲"

// Compare dates
const isAfter = compareJalaliDates(date1, date2) > 0;

Keyboard Navigation

When enableKeyboardNavigation is true:

  • Arrow Keys: Navigate between dates
  • Enter/Space: Select current date
  • Escape: Close picker

Styling

The component uses Tailwind CSS classes. You can customize the appearance by:

  1. Passing custom className props
  2. Overriding Tailwind classes in your CSS
  3. Using the size prop for different sizes

Browser Support

  • Chrome 60+
  • Firefox 55+
  • Safari 12+
  • Edge 79+

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.