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

pyno-date

v1.0.0

Published

A lightweight Angular library for converting and formatting Jalali and Gregorian dates.

Readme

🗓️ pyno-date

A lightweight Angular library for converting and formatting Gregorian and Jalali (Persian) dates. Inspired by PHP's date formatting system.


📦 Installation

npm install pyno-date

⚙️ Setup

Import the module into your Angular app module file or your standalone component:

For module-based apps:

import { PynoDateModule } from 'pyno-date';

@NgModule({
  imports: [
    // ... ,
    PynoDateModule
  ]
})
export class AppModule {}

For standalone components:

import { PynoDateModule } from 'pyno-date';

@Component({
  imports: [
    // ... ,
    PynoDateModule
  ]
})

🧪 Usage in Component

import { PynoDateModule, PynoDateService } from 'pyno-date';

export class AppComponent implements OnInit{
  constructor(pynoDate: PynoDateService) {}
  ngOnInit(){
    // Convert Gregorian date to Jalali (Persian) date
    console.log( this.pynoDate.gregorianToJalali(2025, 5, 28, '13:55') );
    /*{
        jYear: 1404,
        jMonth: 3,
        jDay: 4,
        time: "13:55"
    }*/

    // Convert Jalali (Persian) date to Gregorian date
    console.log( this.pynoDate.jalaliToGregorian(1404, 12, 26, '18:00') );
    /*{
        gYear: 2026,
        gMonth: 3,
        gDay: 17,
        time: "18:00"
    }*/
    
    // Get current timestamp
    console.log( this.pynoDate.time() ); //1748425678
    
    // Get timestamp of a Gregorian or Jalali (Persian) date (and time)
    console.log ( this.pynoDate.getTime( '2025-05-28 13:55' ), 'gregorian' ); //1748440500
    console.log ( this.pynoDate.getTime( {year: 2025, month: 5, day: 28, time: '13:55'} ), 'gregorian' ); //1748440500
    console.log ( this.pynoDate.getTime( '1404/03/25 14:57' ), 'jalali' ); //1749999420
    console.log ( this.pynoDate.getTime( {year: 1404, month: 3, day: 25, time: '14:57'} ), 'jalali' ); //1748440500

    //Get current Gregorian date in any format
    console.log( this.pynoDate.gDate( 'Y-m-d H:i:s' ) ); // 2025-05-28 13:55:46
    
    // Get Gregorian date from timestamp in any format:
    console.log( this.pynoDate.gDate( 'F jS, Y - H:i', 1748440500 ) ); // May 28th, 2005 - 13:55

    //Get current Jalali date in any format
    console.log( this.pynoDate.jDate( 'Y/m/d H:i:s' ) ); // 1404/03/07 13:55:46

    // Get Gregorian date from timestamp in any format:
    console.log( this.pynoDate.jDate( 'l j F Y', 1748440500 ) ); // سه شنبه 24 خرداد 1404
  }
}

🔧 Pipes

1. jDate

Converts a Gregorian date to Jalali.

{{ '2025-03-21' | jDate }}
<!-- Output: 1404/01/01 -->

{{ '2025-03-21 13:55' | jDate }}
<!-- Output: 1404/01/01 13:55 -->

{{ '2025-03-21 13:55' | jDate: 'l j F Y' }}
<!-- Output: جمعه 1 فروردین 1404 -->

{{ {year: 2005, month: 3, day: 21} | jDate: 'Y/m/d' }}
<!-- Output: 1404/01/01 -->

2. gDate

Converts a Jalali date to Gregorian.

{{ '1404/01/01' | gDate }}
<!-- Output: 2025-03-21 -->

{{ '1404/01/01 13:55' | gDate }}
<!-- Output: 2025-03-21 13:55 -->

{{ '1404/01/01 13:55' | gDate: 'l j F Y' }}
<!-- Output: Friday 21 March 2025 -->

{{ {year: 1404, month: 1, day: 1} | gDate: 'Y-m-d' }}
<!-- Output: 2025-03-21 -->

3. jFormat

Formats a Jalali date with a custom pattern.

{{ '1404/01/01 13:55' | jFormat: 'Y-m-d' }}
<!-- Output: 1404-01-01 -->

{{ '1404/01/01 ' | jFormat: 'l j F Y' }}
<!-- Output: جمعه 1 فروردین 1404 -->

4. gFormat

Formats a Gregorian date with a custom pattern.

{{ '2025-03-21 13:55' | jFormat: 'Y/m/d' }}
<!-- Output: 2025/03/21 -->

{{ '2025-03-21 ' | jFormat: 'l j F Y' }}
<!-- Output: Friday 21 March 2025 -->

📅 Format Reference

| Format | En Description | Fa Description | Gregorian Example | Jalali Example | |--------|-------------------------------------------------------------|----------------------------------------|-----------------------------------------|-----------------------------------------| | d | The two digit day of the month | روز ماه بصورت دو رقمی | 01 to 31 | 01 to 31 | | D | A 3-letter textual representation of a day | حرف اول نام روز هفته | Sun to Sat | ش to ج | | j | The day of the month without leading zeros | روز ماه بصورت یک رقمی یا دو رقمی | 1 to 31 | 1 to 31 | | l | A full textual representation of a day | نام روز هفته | Sunday to Saturday | شنبه to جمعه | | N | The ISO-8601 numeric representation of a day | عدد روز در هفته | 1 for Monday, 7 for Sunday | 1 برای یک شنبه، 7 برای شنبه | | S | The English ordinal suffix for the day of the month | واژه ام برای بعد از عدد روز | st nd rd th | ام | | w | A numeric representation of the day | عدد روز در هفته (فارسی) | 0 for Sunday, 7 for Saturday | 0 برای شنبه، 6 برای جمعه | | z | The day of the year | عدد روز در سال | From 0 to 365 | From 0 to 365 | | W | The ISO-8601 week number of year (weeks starting on Monday) | عدد دورقمی هفته در سال | From 00 to 53 | From 00 to 53 | | F | A full textual representation of a month | نام کامل ماه | January to December | فروردین to اسفند | | m | A two-digit representation of a month | عدد ماه بصورت دورقمی | 01 to 12 | 01 to 12 | | M | A 3-letter representation of a month | نام مختصر ماه | Jan to Dec | فر to اس‍ | | n | A numeric representation of a month, without leading zeros | عدد ماه | 1 to 12 | 1 to 12 | | t | The number of days in the given month | تعداد روز در ماه | 28 to 31 | 29 to 31 | | L | Whether it's a leap year | سال کبیثه | 1 if it is a leap year, 0 otherwise | 1 if it is a leap year, 0 otherwise | | o | The ISO-8601 year number | سال هفته ای (به عدد) چهار رقمی | 2025 | 1404 | | Y | A four digit representation of a year | سال (به عدد) چهار رقمی | 2025 | 1404 | | y | A two digit representation of a year | | 25 | 04 | | a | Lowercase am or pm | خلاصه قبل از ظهر یا بعد از ظهر | am pm | ق.ظ ب.ظ | | A | Uppercase AM or PM | قبل از ظهر و بعد از ظهر | AM PM | قبل از ظهر بعد از ظهر | | g | 12-hour format of an hour | ساعت در روز - 12 ساعته | 1 to 12 | 1 to 12 | | G | 24-hour format of an hour | ساعت در روز - 24 ساعته | 0 to 23 | 0 to 23 | | h | A two digit 12-hour format of an hour | ساعت در روز - 12 ساعته - دو رقمی | 01 to 12 | 01 to 12 | | H | A two digit 24-hour format of an hour | ساعت در روز - 24 ساعته - دو رقمی | 01 to 23 | 01 to 23 | | i | A two digit representation of a minute | دقیقه بصورت دورقمی | 00 to 59 | 00 to 59 | | s | A two digit representation of a second | ثانیه بصورت دورقمی | 00 to 59 | 00 to 59 | | O | Difference to Greenwich time (GMT) in hours | تفاوت زمانی با گرینویج به ساعت | +0100 | +0100 | | P | Difference to Greenwich time (GMT) in hours:minutes | تفاوت زمانی با گرینویچ به ساعت و دقیقه | +01:30 | +01:30 | | c | The ISO-8601 date | فرمت استاندارد تاریخ و ساعت | 2025-05-31 16:34:42 | 1404/03/10 16:34:42 | | C | Century number | شماره قرن | 21 | 15 | | r | The RFC 2822 formatted date | فرمت استاندارد روز، تاریخ و ساعت | Fri, 12 Apr 2025 12:01:05 | جمعه، 10 خرداد 1404 16:34:42 | | U | The seconds since the Unix Epoch | ثانیه از زمان شروع Unix | 1748688816 | 1748688816 |


🧠 License

MIT d