Lightweight date conversion utilities between Gregorian and Persian (Jalali) dates.
npm install date-locale> ๐ Lightweight date conversion utilities between Gregorian โ Persian (Jalali) calendars.
> โก Zero-dependency, TypeScript-ready, and tree-shakeable.
---
- ๐ Convert Gregorian โ Persian (Jalali) dates
- ๐ Convert Persian (Jalali) โ Gregorian dates
- โก Written in TypeScript with type definitions
- ๐ฆ Provides ESM and CJS builds
- โ
Zero external dependencies
- ๐ Ready for CI/CD and npm publishing
---
``bash`
npm install date-locale
or using yarn:
`bash`
yarn add date-locale
---
`ts`
import { gregorianToPersianDate, persianToGregorianDate } from 'date-locale';
---
`ts`
const persianDate = gregorianToPersianDate('2025-10-03');
console.log(persianDate);
// ๐ "1404-07-11"
---
`ts`
const gregorianDate = persianToGregorianDate('1404-07-11');
console.log(gregorianDate);
// ๐ "2025-10-03"
---
``
src/
utils/
dateUtils.ts # Shared helper functions
converters/
gregorianToPersian.ts
persianToGregorian.ts
index.ts # Export main API
---
`bash`
npm run build
Generates output in:
``
dist/
index.cjs.js # CommonJS build
index.esm.js # ES Module build
index.d.ts # TypeScript definitions
---
`bash`
node -r ts-node/register <
console.log(gregorianToPersianDate("2025-10-03"));
EOF
---
- โ
CI (GitHub Actions) runs on every PR & push
- ๐ Release workflow publishes to npm when a new Git tag (vX.X.X`) is pushed
---
1. Fork the repo ๐ด
2. Create a new branch ๐ฑ
3. Make your changes โจ
4. Submit a Pull Request ๐
---
MIT ยฉ 2025
---
This package was built to make date conversion between Gregorian and Persian calendars simple, fast, and reliable. Perfect for developers building apps for Iran & international projects. ๐