Jalaali Date-Time Picker

Jalaali Date-Time Picker

Production-ready Jalali (Persian) date + time picker for React / Next.js.

Fully typedTree-shakable ESMTailwind + ShadCNKeyboard nav
npm version
Installation
Add the package & its peer-dependencies.
npm install jalaali-date-time-picker
npm install react next tailwindcss lucide-react

Tailwind configuration

Include the component files so Tailwind can tree-shake unused styles:

// tailwind.config.js
module.exports = {
  content: [
    "./app/**/*.{js,ts,jsx,tsx}",
    "./components/**/*.{js,ts,jsx,tsx}",
    "./node_modules/jalaali-date-time-picker/**/*.{js,ts,jsx,tsx}",
  ],
};

If using globals.css – also @source that path.

RTL support

Wrap with:

<div lang="fa" dir="rtl">...</div>

Quick usage

import { JalaaliDateTimePicker } from "jalaali-date-time-picker";

export default function Example() {
  return (
    <div dir="rtl">
      <JalaaliDateTimePicker onChange={(d) => console.log(d)} />
    </div>
  );
}
Live Demo ↗

Props

Props accepted by JalaaliDateTimePicker
PropTypeDescriptionDefault
valueDate | nullControlled value (makes the picker a controlled component)null
defaultValueDateInitial date for uncontrolled modenew Date()
minDateDateEarliest selectable date
maxDateDateLatest selectable date
disablePastbooleanDisallow dates before todayfalse
disableFuturebooleanDisallow dates after todayfalse
showTimebooleanDisplay hour / minute selectorstrue
minuteStepnumberStep for minute picker (1 – 30)1
format"jalali" | "gregorian"Calendar system used for label & input"jalali"
inlinebooleanRender picker inline instead of sheet/dialogfalse
clearablebooleanShows “clear” button to reset valuefalse
disabledbooleanDisables trigger & interactionfalse
triggerReactNodeYour own trigger element (e.g. input, button)
formatLabel(d: Date) => stringCustom label for selected date/time
placeholderLabelstringText shown when no value is selectedLocalized default
classNamestringExtra CSS classes for wrapper
onOpenChange(open: boolean) => voidFires when sheet/dialog toggles
onClear(prev: Date | null) => voidCalled after value is cleared
inputFieldProps{ name, value, onChange, onBlur, ref }Bridge for React Hook Form, Formik, etc. (maps to hidden input)
inputRefRef<HTMLInputElement>Access the internal hidden input directly

Project Goals

  • Remove external deps one-by-one (starting with icons).
  • Add headless base for custom theming.
  • Support accessibility & language switching.

Contributing

Fork, dev, open PR. Use pnpm cz to commit.

Author

Ali Julaee Rad