{"id":28428943,"url":"https://github.com/amirhsnf/pyno-date","last_synced_at":"2026-03-06T07:31:42.399Z","repository":{"id":296535831,"uuid":"993746014","full_name":"amirhsnf/pyno-date","owner":"amirhsnf","description":"A lightweight Angular library for converting and formatting Jalali and Gregorian dates.","archived":false,"fork":false,"pushed_at":"2025-05-31T12:42:47.000Z","size":9,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-21T23:30:20.687Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amirhsnf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-31T12:37:36.000Z","updated_at":"2025-07-24T14:38:05.000Z","dependencies_parsed_at":"2025-05-31T23:28:28.552Z","dependency_job_id":null,"html_url":"https://github.com/amirhsnf/pyno-date","commit_stats":null,"previous_names":["amirhsnf/pyno-date"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/amirhsnf/pyno-date","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amirhsnf%2Fpyno-date","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amirhsnf%2Fpyno-date/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amirhsnf%2Fpyno-date/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amirhsnf%2Fpyno-date/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amirhsnf","download_url":"https://codeload.github.com/amirhsnf/pyno-date/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amirhsnf%2Fpyno-date/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30165621,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-06T04:43:31.446Z","status":"ssl_error","status_checked_at":"2026-03-06T04:40:30.133Z","response_time":250,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-05T13:08:16.029Z","updated_at":"2026-03-06T07:31:42.351Z","avatar_url":"https://github.com/amirhsnf.png","language":"TypeScript","funding_links":[],"categories":["Third Party Components"],"sub_categories":["DOM"],"readme":"# 🗓️ pyno-date\n\nA lightweight Angular library for converting and formatting Gregorian and Jalali (Persian) dates.\nInspired by PHP's date formatting system.\n\n---\n\n## 📦 Installation\n\n```bash\nnpm install pyno-date\n```\n\n## ⚙️ Setup\nImport the module into your Angular app module file or your standalone component:\n\nFor module-based apps:\n```ts\nimport { PynoDateModule } from 'pyno-date';\n\n@NgModule({\n  imports: [\n    // ... ,\n    PynoDateModule\n  ]\n})\nexport class AppModule {}\n```\n\nFor standalone components:\n```ts\nimport { PynoDateModule } from 'pyno-date';\n\n@Component({\n  imports: [\n    // ... ,\n    PynoDateModule\n  ]\n})\n```\n\n## 🧪 Usage in Component\n\n```ts\nimport { PynoDateModule, PynoDateService } from 'pyno-date';\n\nexport class AppComponent implements OnInit{\n  constructor(pynoDate: PynoDateService) {}\n  ngOnInit(){\n    // Convert Gregorian date to Jalali (Persian) date\n    console.log( this.pynoDate.gregorianToJalali(2025, 5, 28, '13:55') );\n    /*{\n        jYear: 1404,\n        jMonth: 3,\n        jDay: 4,\n        time: \"13:55\"\n    }*/\n\n    // Convert Jalali (Persian) date to Gregorian date\n    console.log( this.pynoDate.jalaliToGregorian(1404, 12, 26, '18:00') );\n    /*{\n        gYear: 2026,\n        gMonth: 3,\n        gDay: 17,\n        time: \"18:00\"\n    }*/\n    \n    // Get current timestamp\n    console.log( this.pynoDate.time() ); //1748425678\n    \n    // Get timestamp of a Gregorian or Jalali (Persian) date (and time)\n    console.log ( this.pynoDate.getTime( '2025-05-28 13:55' ), 'gregorian' ); //1748440500\n    console.log ( this.pynoDate.getTime( {year: 2025, month: 5, day: 28, time: '13:55'} ), 'gregorian' ); //1748440500\n    console.log ( this.pynoDate.getTime( '1404/03/25 14:57' ), 'jalali' ); //1749999420\n    console.log ( this.pynoDate.getTime( {year: 1404, month: 3, day: 25, time: '14:57'} ), 'jalali' ); //1748440500\n\n    //Get current Gregorian date in any format\n    console.log( this.pynoDate.gDate( 'Y-m-d H:i:s' ) ); // 2025-05-28 13:55:46\n    \n    // Get Gregorian date from timestamp in any format:\n    console.log( this.pynoDate.gDate( 'F jS, Y - H:i', 1748440500 ) ); // May 28th, 2005 - 13:55\n\n    //Get current Jalali date in any format\n    console.log( this.pynoDate.jDate( 'Y/m/d H:i:s' ) ); // 1404/03/07 13:55:46\n\n    // Get Gregorian date from timestamp in any format:\n    console.log( this.pynoDate.jDate( 'l j F Y', 1748440500 ) ); // سه شنبه 24 خرداد 1404\n  }\n}\n\n```\n\n---\n\n## 🔧 Pipes\n\n### 1. `jDate`\nConverts a Gregorian date to Jalali.\n\n```html\n{{ '2025-03-21' | jDate }}\n\u003c!-- Output: 1404/01/01 --\u003e\n\n{{ '2025-03-21 13:55' | jDate }}\n\u003c!-- Output: 1404/01/01 13:55 --\u003e\n\n{{ '2025-03-21 13:55' | jDate: 'l j F Y' }}\n\u003c!-- Output: جمعه 1 فروردین 1404 --\u003e\n\n{{ {year: 2005, month: 3, day: 21} | jDate: 'Y/m/d' }}\n\u003c!-- Output: 1404/01/01 --\u003e\n```\n\n### 2. `gDate`\nConverts a Jalali date to Gregorian.\n\n```html\n{{ '1404/01/01' | gDate }}\n\u003c!-- Output: 2025-03-21 --\u003e\n\n{{ '1404/01/01 13:55' | gDate }}\n\u003c!-- Output: 2025-03-21 13:55 --\u003e\n\n{{ '1404/01/01 13:55' | gDate: 'l j F Y' }}\n\u003c!-- Output: Friday 21 March 2025 --\u003e\n\n{{ {year: 1404, month: 1, day: 1} | gDate: 'Y-m-d' }}\n\u003c!-- Output: 2025-03-21 --\u003e\n```\n\n### 3. `jFormat`\nFormats a Jalali date with a custom pattern.\n\n```html\n{{ '1404/01/01 13:55' | jFormat: 'Y-m-d' }}\n\u003c!-- Output: 1404-01-01 --\u003e\n\n{{ '1404/01/01 ' | jFormat: 'l j F Y' }}\n\u003c!-- Output: جمعه 1 فروردین 1404 --\u003e\n```\n\n### 4. `gFormat`\nFormats a Gregorian date with a custom pattern.\n\n```html\n{{ '2025-03-21 13:55' | jFormat: 'Y/m/d' }}\n\u003c!-- Output: 2025/03/21 --\u003e\n\n{{ '2025-03-21 ' | jFormat: 'l j F Y' }}\n\u003c!-- Output: Friday 21 March 2025 --\u003e\n```\n\n---\n\n## 📅 Format Reference\n\n| Format | En Description                                              | Fa Description                         | Gregorian Example                       | Jalali Example                          |\n|--------|-------------------------------------------------------------|----------------------------------------|-----------------------------------------|-----------------------------------------|\n| `d`    | The two digit day of the month                              | روز ماه بصورت دو رقمی                  | `01` to `31`                            | `01` to `31`                            |\n| `D`    | A 3-letter textual representation of a day                  | حرف اول نام روز هفته                   | `Sun` to `Sat`                          | `ش` to `ج`                              |\n| `j`    | The day of the month without leading zeros                  | روز ماه بصورت یک رقمی یا دو رقمی       | `1` to `31`                             | `1` to `31`                             |\n| `l`    | A full textual representation of a day                      | نام روز هفته                           | `Sunday` to `Saturday`                  | `شنبه` to `جمعه`                        |\n| `N`    | The ISO-8601 numeric representation of a day                | عدد روز در هفته                        | `1` for Monday, `7` for Sunday          | `1` برای یک شنبه، `7` برای شنبه         |\n| `S`    | The English ordinal suffix for the day of the month         | واژه `ام` برای بعد از عدد روز          | `st` `nd` `rd` `th`                     | `ام`                                    |\n| `w`    | A numeric representation of the day                         | عدد روز در هفته (فارسی)                | `0` for Sunday, `7` for Saturday        | `0` برای شنبه، `6` برای جمعه            |\n| `z`    | The day of the year                                         | عدد روز در سال                         | From `0` to `365`                       | From `0` to `365`                       |\n| `W`    | The ISO-8601 week number of year (weeks starting on Monday) | عدد دورقمی هفته در سال                 | From `00` to `53`                       | From `00` to `53`                       |\n| `F`    | A full textual representation of a month                    | نام کامل ماه                           | `January` to `December`                 | `فروردین` to `اسفند`                    |\n| `m`    | A two-digit representation of a month                       | عدد ماه بصورت دورقمی                   | `01` to `12`                            | `01` to `12`                            |\n| `M`    | A 3-letter representation of a month                        | نام مختصر ماه                          | `Jan` to `Dec`                          | `فر` to `اس‍`                           |\n| `n`    | A numeric representation of a month, without leading zeros  | عدد ماه                                | `1` to `12`                             | `1` to `12`                             |\n| `t`    | The number of days in the given month                       | تعداد روز در ماه                       | `28` to `31`                            | `29` to `31`                            |\n| `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 |\n| `o`    | The ISO-8601 year number                                    | سال هفته ای (به عدد) چهار رقمی\t        | `2025`                                  | `1404`                                  |\n| `Y`    | A four digit representation of a year                       | سال (به عدد) چهار رقمی\t                | `2025`                                  | `1404`                                  |\n| `y`    | A two digit representation of a year                        |                                        | ` 25`                                   | `04`                                    |\n| `a`    | Lowercase am or pm                                          | خلاصه قبل از ظهر یا بعد از ظهر         | `am` `pm`                               | `ق.ظ` `ب.ظ`                             |\n| `A`    | Uppercase AM or PM                                          | قبل از ظهر و بعد از ظهر                | `AM` `PM`                               | `قبل از ظهر` `بعد از ظهر`               |\n| `g`    | 12-hour format of an hour                                   | ساعت در روز - 12 ساعته                 | `1` to `12`                             | `1` to `12`                             |\n| `G`    | 24-hour format of an hour                                   | ساعت در روز - 24 ساعته                 | `0` to `23`                             | `0` to `23`                             |\n| `h`    | A two digit 12-hour format of an hour                       | ساعت در روز - 12 ساعته - دو رقمی       | `01` to `12`                            | `01` to `12`                            |\n| `H`    | A two digit 24-hour format of an hour                       | ساعت در روز - 24 ساعته - دو رقمی       | `01` to `23`                            | `01` to `23`                            |\n| `i`    | A two digit representation of a minute                      | دقیقه بصورت دورقمی                     | `00` to `59`                            | `00` to `59`                            |\n| `s`    | A two digit representation of a second                      | ثانیه بصورت دورقمی                     | `00` to `59`                            | `00` to `59`                            |\n| `O`    | Difference to Greenwich time (GMT) in hours                 | تفاوت زمانی با گرینویج به ساعت         | `+0100`                                 | `+0100`                                 |\n| `P`    | Difference to Greenwich time (GMT) in hours:minutes         | تفاوت زمانی با گرینویچ به ساعت و دقیقه | `+01:30`                                | `+01:30`                                |\n| `c`    | The ISO-8601 date                                           | فرمت استاندارد تاریخ و ساعت            | `2025-05-31 16:34:42`                   | `1404/03/10 16:34:42`                   |\n| `C`    | Century number                                              | شماره قرن                              | `21`                                    | `15`                                    |\n| `r`    | The RFC 2822 formatted date                                 | فرمت استاندارد روز، تاریخ و ساعت       | `Fri, 12 Apr 2025 12:01:05`             | `جمعه، 10 خرداد 1404 16:34:42`          |\n| `U`    | The seconds since the Unix Epoch                            | ثانیه از زمان شروع Unix                | `1748688816`                            | `1748688816`                            |\n\n\n\n---\n\n## 🧠 License\n\nMIT\nd\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famirhsnf%2Fpyno-date","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famirhsnf%2Fpyno-date","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famirhsnf%2Fpyno-date/lists"}