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

@lomineuro/jalali-web-component

v1.0.0

Published

Framework-agnostic Jalali Date Picker Web Component - Works with React, Vue, Angular, Svelte, and Vanilla JS

Readme

@lomineuro/jalali-web-component

A framework-agnostic Jalali Date Picker Web Component built with Vanilla TypeScript. Works seamlessly with React, Vue, Angular, Svelte, and Vanilla JavaScript.

🌟 Features

  • Framework-Agnostic: Pure Web Component standard - works with any framework
  • Multiple Calendar Systems: Jalali (Persian), Gregorian, and Hijri calendars
  • Three Selection Modes: Single date, date range, and multiple dates
  • Shadow DOM Encapsulation: Scoped styling with no conflicts
  • Custom Events: Easy event-driven API
  • Bilingual Support: Persian (فارسی) and English
  • RTL/LTR Support: Full bidirectional text support
  • Type-Safe: Complete TypeScript support
  • Performance Optimized: Minimal bundle size, internal caching
  • Accessible: ARIA labels and keyboard navigation

📦 Installation

npm install @lomineuro/jalali-web-component

🚀 Quick Start

Vanilla JavaScript

<!DOCTYPE html>
<html>
<head>
  <script src="node_modules/@lomineuro/jalali-web-component/dist/index.esm.js"></script>
</head>
<body>
  <jalali-date-picker
    locale="fa"
    selection-mode="single">
  </jalali-date-picker>

  <script>
    const picker = document.querySelector('jalali-date-picker');
    picker.addEventListener('dateSelect', (e) => {
      console.log('Selected:', e.detail.jalaliDate);
    });
  </script>
</body>
</html>

React

import { useRef, useEffect } from 'react';
import '@lomineuro/jalali-web-component';

export function DatePicker() {
  const pickerRef = useRef(null);

  useEffect(() => {
    pickerRef.current?.addEventListener('dateSelect', (e) => {
      console.log('Selected:', e.detail.jalaliDate);
    });
  }, []);

  return (
    <jalali-date-picker
      ref={pickerRef}
      locale="fa"
      selection-mode="single"
    />
  );
}

Vue

<template>
  <jalali-date-picker
    ref="picker"
    locale="fa"
    @dateSelect="onDateSelect">
  </jalali-date-picker>
</template>

<script>
import '@lomineuro/jalali-web-component';

export default {
  methods: {
    onDateSelect(e) {
      console.log('Selected:', e.detail.jalaliDate);
    }
  }
}
</script>

Angular

import { Component } from '@angular/core';
import '@lomineuro/jalali-web-component';

@Component({
  selector: 'app-date-picker',
  template: `
    <jalali-date-picker
      [attr.locale]="'fa'"
      [attr.selection-mode]="'single'"
      (dateSelect)="onDateSelect($event)">
    </jalali-date-picker>
  `
})
export class DatePickerComponent {
  onDateSelect(event: any) {
    console.log('Selected:', event.detail.jalaliDate);
  }
}

📋 API Reference

Attributes

| Attribute | Type | Default | Description | |-----------|------|---------|-------------| | locale | 'fa' \| 'en' | 'fa' | Display language | | selection-mode | 'single' \| 'range' \| 'multiple' | 'single' | Selection mode | | disabled-dates | string | - | JSON array of disabled dates | | min-date | string | - | Minimum selectable date (YYYY-MM-DD) | | max-date | string | - | Maximum selectable date (YYYY-MM-DD) | | theme | string | 'default' | Theme name |

Events

| Event | Detail | Description | |-------|--------|-------------| | dateSelect | { jalaliDate, gregorianDate, hijriDate } | Single date selected | | rangeSelect | { start, end } | Date range selected | | multipleSelect | { dates: [] } | Multiple dates selected | | localeChange | { locale } | Locale changed |

Methods

// Get selected date(s)
picker.getSelectedDate(): Date | null
picker.getSelectedRange(): { start: Date; end: Date } | null
picker.getSelectedDates(): Date[]

// Set selected date(s)
picker.setSelectedDate(date: Date): void
picker.setSelectedRange(start: Date, end: Date): void
picker.setSelectedDates(dates: Date[]): void

// Clear selection
picker.clearSelection(): void

// Set locale
picker.setLocale(locale: 'fa' | 'en'): void

🎨 Styling

The component uses Shadow DOM for style encapsulation. You can customize it with CSS variables:

jalali-date-picker {
  --primary-color: #3b82f6;
  --secondary-color: #10b981;
  --text-color: #1f2937;
  --border-color: #e5e7eb;
  --border-radius: 8px;
}

📚 Examples

Single Date Selection

<jalali-date-picker
  locale="fa"
  selection-mode="single">
</jalali-date-picker>

Date Range Selection

<jalali-date-picker
  locale="fa"
  selection-mode="range">
</jalali-date-picker>

Multiple Dates Selection

<jalali-date-picker
  locale="fa"
  selection-mode="multiple">
</jalali-date-picker>

With Disabled Dates

<jalali-date-picker
  locale="fa"
  disabled-dates='["1402-01-01", "1402-01-02"]'>
</jalali-date-picker>

With Date Range Limits

<jalali-date-picker
  locale="fa"
  min-date="1402-01-01"
  max-date="1402-12-29">
</jalali-date-picker>

🔄 Calendar Systems

The component supports three calendar systems:

  • Jalali (Persian): Used in Iran, Afghanistan
  • Gregorian: International standard
  • Hijri (Islamic): Used in Islamic countries

All conversions are bidirectional and accurate.

🌍 Localization

Supports multiple languages:

  • Persian (فارسی): locale="fa"
  • English: locale="en"

♿ Accessibility

  • ARIA labels for screen readers
  • Keyboard navigation support
  • High contrast mode support
  • Focus management

📊 Performance

  • Bundle Size: ~50KB (minified + gzipped)
  • No Dependencies: Pure TypeScript
  • Internal Caching: Optimized date conversions
  • Lazy Loading: Components load on demand

🧪 Testing

npm test

📄 License

MIT

🤝 Contributing

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

📞 Support

For issues and questions, please visit:


Made with ❤️ for the Persian community