{"id":35319301,"url":"https://github.com/alihoseiny/ngx-persian","last_synced_at":"2025-12-31T11:01:37.163Z","repository":{"id":34300745,"uuid":"174525782","full_name":"alihoseiny/ngx-persian","owner":"alihoseiny","description":"A full-featured toolset for Persian Applications Created by Angular (v \u003e 2) containing Pipes, Services, Directives, and javascript Similar Date object for working with Jalali Date.","archived":false,"fork":false,"pushed_at":"2025-12-21T12:27:33.000Z","size":29687,"stargazers_count":105,"open_issues_count":28,"forks_count":15,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-12-23T03:47:38.812Z","etag":null,"topics":["angular","angular2","javascript","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alihoseiny.png","metadata":{"files":{"readme":"README.md","changelog":"Changelog.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","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},"funding":{"custom":["https://payping.ir/@alihoseiny"]}},"created_at":"2019-03-08T11:28:13.000Z","updated_at":"2025-12-21T12:26:06.000Z","dependencies_parsed_at":"2024-06-19T00:17:08.951Z","dependency_job_id":"53d7cd11-add2-409f-b602-719c02c3a31f","html_url":"https://github.com/alihoseiny/ngx-persian","commit_stats":{"total_commits":210,"total_committers":6,"mean_commits":35.0,"dds":0.5714285714285714,"last_synced_commit":"de393d719877f51ad6349f005b0bbcb47d901825"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/alihoseiny/ngx-persian","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alihoseiny%2Fngx-persian","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alihoseiny%2Fngx-persian/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alihoseiny%2Fngx-persian/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alihoseiny%2Fngx-persian/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alihoseiny","download_url":"https://codeload.github.com/alihoseiny/ngx-persian/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alihoseiny%2Fngx-persian/sbom","scorecard":{"id":184132,"data":{"date":"2025-08-11","repo":{"name":"github.com/alihoseiny/ngx-persian","commit":"de393d719877f51ad6349f005b0bbcb47d901825"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/4 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/node.js.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Pinned-Dependencies","score":3,"reason":"dependency not pinned by hash detected -- score normalized to 3","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/alihoseiny/ngx-persian/node.js.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/alihoseiny/ngx-persian/node.js.yml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   1 out of   1 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 28 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"61 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-fwr7-v2mv-hh25","Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-r7qp-cfhv-p84w","Warn: Project is vulnerable to: GHSA-q9mw-68c2-j6m5","Warn: Project is vulnerable to: GHSA-67mh-4wv8-2f99","Warn: Project is vulnerable to: GHSA-rv95-896h-c2vc","Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx","Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc","Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp","Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j","Warn: Project is vulnerable to: GHSA-c7qv-q95q-8v27","Warn: Project is vulnerable to: GHSA-4www-5p9h-95mh","Warn: Project is vulnerable to: GHSA-9gqv-wp59-fq42","Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22","Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-76p3-8jx3-jpfq","Warn: Project is vulnerable to: GHSA-3rfm-jhwj-7488","Warn: Project is vulnerable to: GHSA-hhq3-ff78-jv3g","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55","Warn: Project is vulnerable to: GHSA-5rrq-pxf6-6jx5","Warn: Project is vulnerable to: GHSA-8fr3-hfg3-gpgp","Warn: Project is vulnerable to: GHSA-gf8q-jrpm-jvxq","Warn: Project is vulnerable to: GHSA-2r2c-g63r-vccr","Warn: Project is vulnerable to: GHSA-cfm4-qjh2-4765","Warn: Project is vulnerable to: GHSA-x4jg-mjrx-434g","Warn: Project is vulnerable to: GHSA-76c9-3jph-rj3q","Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j","Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w","Warn: Project is vulnerable to: GHSA-7fh5-64p2-3v2j","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg","Warn: Project is vulnerable to: GHSA-76p7-773f-r4q5","Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p","Warn: Project is vulnerable to: GHSA-25hc-qcg6-38wj","Warn: Project is vulnerable to: GHSA-qm95-pgcg-qqfq","Warn: Project is vulnerable to: GHSA-cqmj-92xf-r6r9","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-4wf5-vphf-c2xc","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-fhg7-m89q-25r3","Warn: Project is vulnerable to: GHSA-hc6q-2mpp-qw7j","Warn: Project is vulnerable to: GHSA-4vvj-4cpr-p986","Warn: Project is vulnerable to: GHSA-wr3j-pwj9-hqq6","Warn: Project is vulnerable to: GHSA-4v9v-hfq4-rm2v","Warn: Project is vulnerable to: GHSA-9jgg-88mc-972h","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q","Warn: Project is vulnerable to: GHSA-phwq-j96m-2c2q","Warn: Project is vulnerable to: GHSA-ghr5-ch3p-vcr6","Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-16T19:27:14.499Z","repository_id":34300745,"created_at":"2025-08-16T19:27:14.499Z","updated_at":"2025-08-16T19:27:14.499Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28142766,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-31T02:00:06.200Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["angular","angular2","javascript","typescript"],"created_at":"2025-12-30T21:00:34.255Z","updated_at":"2025-12-31T11:01:37.156Z","avatar_url":"https://github.com/alihoseiny.png","language":"TypeScript","funding_links":["https://payping.ir/@alihoseiny"],"categories":["Third Party Components"],"sub_categories":["Mixed Utilities"],"readme":"# NgxPersian\n![npm](https://img.shields.io/npm/dt/ngx-persian.svg?style=popout-square)\n![npm](https://img.shields.io/npm/v/ngx-persian.svg?style=popout-square)\n![documentation](https://img.shields.io/badge/documentation-73%25-blueviolet.svg?style=popout-square)\n![test coverage](https://img.shields.io/badge/Test%20Coverage-90%25-success.svg?style=popout-square)\n\n\nA full featured tool set for Persian Applications Created by Angular (v \u003e 2) containing Pipes, Services, Directives and javascript Similar Date object for working with Jalali Date.\n\nYou can use Tools provided by this library for:\n- Converting English numbers to Persian numbers and vise versa\n- Validating persian text with different options\n- Validating persian numbers for numeric inputs\n- Converting and validating Jalali Date and time like native javascript Date object\n- Formatting Jalali Dates using jdate pipe\n- Formatting currency values in Rial or Toman currency type with flexable options.\n- Validating and Formatting Iranian National Number\n- Validating phone numbers of Iranian Mobile operators.\n- Getting operator name of a phone number in English or Persian\n- Validating reactive and template-base form inputs for persian numbers or texts.\n\n## Why you should use this library?\nThere are many reasons for using this library For everyone who develops an Angular application for people living in Iran:\n* You can find almost everything you need in a signle library and don't need to install thousand of different libraries.\n* It's developed for recent version of angular (v4 to v7) and is not out ot date like most of other libraries.\n* We solved problems in Angular way, not like most of other libraries those only glued a js solution to the Angular and Typescript.\n* It's alive! Many of other persian libraries have unanswered issues from 1-2 year ago.\n* Almost everything has been tested. There are more than 590 unit tests written for all parts. So you can use everything without any fear of breaking things down.\n* It's documented. Everything are clear and you can find anything you want from this document, code document and also unit test.\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n**Table of Contents**\n\n- [NgxPersian](#ngxpersian)\n  - [Why you should use this library?](#why-you-should-use-this-library)\n- [How to Install?](#how-to-install)\n- [Documents](#documents)\n  - [Pipes](#pipes)\n    - [faNum](#fanum)\n    - [enNum](#ennum)\n    - [irc](#irc)\n    - [nationalCode](#nationalcode)\n    - [jdate](#jdate)\n  - [Services](#services)\n    - [PersianNumberService](#persiannumberservice)\n    - [PersianLetterService](#persianletterservice)\n    - [MobilePhoneNumberService](#mobilephonenumberservice)\n    - [JalaliDateValidatorService](#jalalidatevalidatorservice)\n    - [JalaliDateCalculatorService](#jalalidatecalculatorservice)\n  - [Jalali Date](#jalali-date)\n  - [NationalCodeService](#nationalcodeservice)\n  - [Validators](#validators)\n    - [persianNumbersValidator](#persiannumbersvalidator)\n    - [persianNumbersValidator](#persiannumbersvalidator-1)\n  - [Directives](#directives)\n- [Contribution](#contribution)\n- [There is any problem?](#there-is-any-problem)\n- [Citations](#citations)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n\n\n# How to Install?\nFor installing this library, you can simply run following command in your Angular app root:\n\n`npm install ngx-persian --save`\n\nFor installing the library globally, you can run following command instead:\n\n`npm install ngx-persian -g`\n\n# Documents\nShort documentation of the library is here. For more detailed documents, you can see the [code document](https://alihoseiny.github.io/ngx-persian/).\n\n## Pipes\nWe are using pipes for formatting values in the templates. We Have 4 Different pipes in the **ngx-persian** for formatting stuff needed by the persian app developers:\n### faNum\nThis pipe replaces all the English and Arabic digits to the Persian Digits without any need for additional code or parameter.\n\nFor using this pipe, firstly you need to import the pipe from the library in your module:\n\n`import {FaNumPipe} from 'ngx-persian';`\n\nThen, like any other pipe, you need to _declare_ the pipe in your module. For this, you should add following line in the `declarations` array of the `@NgModule` of your module:\n\n`FaNumPipe,`\n\nNow you can this pipe anywhere you like in your templates.\n\nFor example, if we want to convert non-english digits in a attribute named: `englishTextDigit`, we can use this code in our template:\n\n`{{englishTextDigit | faNum}}`\n\n### enNum\nThis pipe replaces all the Persian Digits to English digits without any need for additional code or parameter.\n\nFor using this pipe, firstly you need to import the pipe from the library in your module:\n\n`import {EnNumPipe} from 'ngx-persian';`\n\nThen, like any other pipe, you need to _declare_ the pipe in your module. For this, you should add following line in the `declarations` array of the `@NgModule` of your module:\n\n`EnNumPipe,`\n\nYou can use this pipe anywhere you like in your templates for converting persian digits to english digits.\n\nFor example, if we want to convert persian digits in a attribute named: `persianTextDigit`, we can use this code in our template:\n`{{persianTextDigit | enNum}}`\n\nYou can see the example usage of these pipes in below GIF:\n\n![faNum and enNum pipes](https://github.com/alihoseiny/ngx-persian/raw/master/Usage%20Examples/faNum%20and%20enNum%20pipes.gif \"Animation of faNum and enNum pipes usage\")\n\n**Still have questions?** see the [related part of example app](https://github.com/alihoseiny/ngx-persian/tree/master/TestApplication/src/app/pipes-test) or see: [related section in code document for EnNumPipe](https://alihoseiny.github.io/ngx-persian/pipes/EnNumPipe.html) or see: [related section in code document for FaNumPipe](https://alihoseiny.github.io/ngx-persian/pipes/FaNumPipe.html).\n\nAlso you can see [unit tests of FaNumPipe](https://github.com/alihoseiny/ngx-persian/blob/master/projects/ngx-persian/src/lib/Pipes/faNum.pipe.spec.ts) and [unit tests of EnNumPipe](https://github.com/alihoseiny/ngx-persian/blob/master/projects/ngx-persian/src/lib/Pipes/enNum.pipe.spec.ts) for more examples of how input and outputs could be.\n### irc\nThis pipe formats currency values for two popular currency types in Iran: Rial and Toman.\n\nThis pipes accepts one optional parameter for declaring currency type And get's this value as first parameter.\n\nPossible values for currency type parameter:\n\n|Value|Output currency type|\n|---|---|\n|R|ریال|\n|RIAL|ریال|\n|T|تومان|\n|TOMAN|تومان|\n\nThe default value is `r`, so if you don't set any currency type, this pipe will consider that you've chosen rial currency type.\n\nFor using this pipe, firstly you need to import the pipe from the library in your module:\n\n`import {IRCurrencyPipe} from 'ngx-persian';`\n\nThen, like any other pipe, you need to _declare_ the pipe in your module. For this, you should add following line in the `declarations` array of the `@NgModule` of your module:\n\n`IRCurrencyPipe,`\n\nYou can use this pipe anywhere you like in your templates for formatting a currency value in Iranian currency types.\n\nFor example, For converting a digit to rial:\n`{{13750 | irc}}` output will be: `13,750 ریال`\n\nYou can pass currency type parameter as below:\n\n`{{13750 | irc:'T'}}`\n\nThe output will be like:\n`137,750 تومان`\n\nYou can see the example usage of this pipes in below GIF:\n\n![IR Currency pipe for formatting currency values in rial or toman](https://github.com/alihoseiny/ngx-persian/raw/master/Usage%20Examples/IRCurrency-toman.gif \"IR Currency pipe for formatting currency values in rial or toman\")\n\nFor example, below code recreates default behaviour of the pipe (Grouping each 3 digit from right):\n\n`{{13750 | irc:'R'}}`\n\nIn regular uses, you never need to pass the second parameter, but it's here for more special usages.\n\n**Still have questions?** see the [related part of example app](https://github.com/alihoseiny/ngx-persian/tree/master/TestApplication/src/app/pipes-test) or see: [related section in code document for IRCurrencyPipe](https://alihoseiny.github.io/ngx-persian/pipes/IRCurrencyPipe.html).\n\nAlso you can see [unit tests of IRCurrencyPipe](https://github.com/alihoseiny/ngx-persian/blob/master/projects/ngx-persian/src/lib/Pipes/IRCurrency.pipe.spec.ts) for more examples of how input and outputs could be.\n\n### nationalCode\nThis pipe formats a 10-digit string to national code format like:\n\n`xxx-xxxxxx-x`\n\nFor using this pipe, firstly you need to import the pipe from the library in your module:\n\n`import {NationalCodePipe} from 'ngx-persian';`\n\nThen, like any other pipe, you need to _declare_ the pipe in your module. For this, you should add following line in the `declarations` array of the `@NgModule` of your module:\n\n`NationalCodePipe,`\n\nYou can use this pipe anywhere you like in your templates for formatting iranian national number.\nFor example: `0011753646 | nationalCode` produces following text: `001-175364-6`\n\nYou can see the example usage of this pipes in below GIF:\n\n![Iranian national code formatter pipe](https://github.com/alihoseiny/ngx-persian/raw/master/Usage%20Examples/NationalCodePipe.gif \"Iranian national number formatter pipe\")\n\n**Still have questions?** see the [related part of example app](https://github.com/alihoseiny/ngx-persian/tree/master/TestApplication/src/app/pipes-test) or see: [related section in code document for NationalCodePipe](https://alihoseiny.github.io/ngx-persian/pipes/NationalCodePipe.html).\n\nAlso you can see [unit tests of NationalCodePipe](https://github.com/alihoseiny/ngx-persian/blob/master/projects/ngx-persian/src/lib/Pipes/nationalCode.pipe.spec.ts) for more examples of how input and outputs could be.\n\n### jdate\nThis pipe formats [`JDate`](#jalali-date) object and creates a human readable text with different pre-defined formats. Also you can pass your custom format to it.\nIf you pass instances of `Date` class those representing Georgian DateTime objects, this pipe first convert that object to an instance of `JDate` class, and then returns formatted Jalali datetime from it.\n\nYou can pass Format name or custom format pattern as second parameter of this pipe.\n\nFor using this pipe, firstly you need to import the pipe from the library in your module:\n\n`import {JdatePipe} from 'ngx-persian';`\n\nThen, like any other pipe, you need to _declare_ the pipe in your module. For this, you should add following line in the `declarations` array of the `@NgModule` of your module:\n\n`JdatePipe,`\n\nYou can use this pipe anywhere you like in your templates for formatting Jalali dates as `JDate` objects or converting and then formatting Georgian dates as `Date` objects.\nFor example: ` dateObject | jdate` produces following text: `23 اردیبهشت 1397، 12:12 ب.ظ'`\n\nFor changing formatting pattern, you can set second parameter like this:\n\n`dateObject| jdate:'SHORT'` That produces this result: `97/2/23 12:12 ب.ظ `\n\nBelow you can see list of pre-defined formats:\n\n|Format name|Equivalent Pattern String|Example Result|\n|---|---|---|\n|SHORT|`yy/m/d h:M t`|97/2/23 12:12 ب.ظ'|\n|SHORT_DATE|`yy/m/d h:M t`|97/2/23 12:12 ب.ظ|\n|MEDIUM|`d mmm yyyy، h:M t`|23 اردیبهشت 1397، 12:12 ب.ظ|\n|MEDIUM_DATE|`d mmm yyyy، h:M t`|23 اردیبهشت 1397، 12:12 ب.ظ|\n|LONG|`d mmm yyyy، h:M:S T`|23 اردیبهشت 1397، 12:12:30 بعد از ظهر|\n|LONG_DATE|`d mmm yyyy، h:M:S T`|23 اردیبهشت 1397، 12:12:30 بعد از ظهر|\n|SHORT_TIME|`h:M t`|12:12 ب.ظ|\n|MEDIUM_TIME|`h:M:S t`|12:12:30 ب.ظ|\n|LONG_TIME|`h:M:S.l T`|12:12:30.300 بعد از ظهر|\n\nAlso instead of those pattern names, you can set your desired pattern string as described in the [documents of format method of JDate object]().\n\n**Still have questions?** see the [related part of example app](https://github.com/alihoseiny/ngx-persian/tree/master/TestApplication/src/app/pipes-test) or see: [related section in code document for JdatePipe](https://alihoseiny.github.io/ngx-persian/pipes/JdatePipe.html).\n\n\nAlso you can see [unit tests of JdatePipe](https://github.com/alihoseiny/ngx-persian/blob/master/projects/ngx-persian/src/lib/Pipes/jdate.pipe.spec.ts) for more examples of how input and outputs could be.\n\n## Services\nWe provide some useful Angular Services for data validation and conversion. You can _Inject_ Them anywhere you like using Angular DI.\n\n### PersianNumberService\nThis service created for validation of strings contains persian digits and converting other digits to the persian ones.\n\nFor reading more detailed document, you can see [related part of code document of the PersianNumberService](https://alihoseiny.github.io/ngx-persian/injectables/PersianNumberService.html).\n\n#### Adding PersianNumberService to Your Application\nFor using this service you only need to import it in the file you want to use that in it. Simple as this:\n\n`import {PersianNumberService} from 'ngx-persian';`\n\nFor _Injecting_ this service, you just need to add it in the constructor of your service or component like this:\n\n`constructor(private persianNumberService: PersianNumberService) {}`\n\nNow you can use it like other attributes of your class with `this` keyword.\n\nSo lets digging deep to the class and see what its methods do:\n\n#### arabicToPersian\nYou can use this method for converting arabic digits in the input string with persian digits. This method will not change other characters of the string and left them unchanged.\n\nExample:\n```typescript\nconsole.log(this.persianNumberService.arabicToPersian('٤٥٦'))\n// Expected output: ۴۵۶\n```  \nFor more information you can see the [related part of code document about arabicToPersian method](https://alihoseiny.github.io/ngx-persian/injectables/PersianNumberService.html#arabicToPersian). Also for more examples, you can see the [unit tests of the arabicToPersian method](https://github.com/alihoseiny/ngx-persian/blob/e198c5577abca4bc634ea20ef1bccb863c8796ef/projects/ngx-persian/src/lib/Services/persian-number.service.spec.ts#L95).\n#### containsPersian\nThis method checks if input text contains **any** persian digit. So if there is at least one persian digit in the input, returns `true`.\n\nExample:\n```typescript\nif (this.persianNumberService.containsPersian('A long text with english و فارسی words with a persian digit: ۱')) {\n  console.log('Input text contains persian digits.');\n} \n\nif (!this.persianNumberService.containsPersian('یک متن فارسی با اعداد انگلیسی 156465 که رقم فارسی ندارد.')){\n  console.log('input text does not contain persian digits.');\n}\n``` \nFor more information you can see the [related part of code document about containsPersian method](https://alihoseiny.github.io/ngx-persian/injectables/PersianNumberService.html#containsPersian). Also for more examples, you can see the [unit tests of the containsPersian method](https://github.com/alihoseiny/ngx-persian/blob/e198c5577abca4bc634ea20ef1bccb863c8796ef/projects/ngx-persian/src/lib/Services/persian-number.service.spec.ts#L18).\n\n#### isPersian\nThis method check if input string contains **ONLY** persian digits. So if there is any other character, returns `false`.\n\nExample:\n```typescript\nif (this.persianNumberService.isPersian('۶۸۷۹۷۹۷')) {\n  console.log('Input string contains only persian numbers.')\n} \n\nif (!this.persianNumberService.isPersian('۷۶۷۶۸ ۸۹۰۹۷')) {\n  console.log('Input string does not contain only persian numbers');\n} \n```\nFor more information you can see the [related part of code document about isPersian method](https://alihoseiny.github.io/ngx-persian/injectables/PersianNumberService.html#isPersian). Also for more examples, you can see the [unit tests of the isPersian method](https://github.com/alihoseiny/ngx-persian/blob/e198c5577abca4bc634ea20ef1bccb863c8796ef/projects/ngx-persian/src/lib/Services/persian-number.service.spec.ts#L59).\n\n#### toEnglish\nConverts all Persian digits in the input string to English digits. This method will not change any other characters of the input.\n\nExample:\n```typescript\nconsole.log(this.persianNumberService.toEnglish('یک متن با اعداد فارسی مثل ۵۴۳۲۴۴۵'));\n// Expected output: یک متن با اعداد فارسی مثل 5432445\n```\nFor more information you can see the [related part of code document about toEnglish method](https://alihoseiny.github.io/ngx-persian/injectables/PersianNumberService.html#toEnglish). Also for more examples, you can see the [unit tests of the toEnglish method](https://github.com/alihoseiny/ngx-persian/blob/e198c5577abca4bc634ea20ef1bccb863c8796ef/projects/ngx-persian/src/lib/Services/persian-number.service.spec.ts#L143).\n\n#### toPersian\nThis method converts all English and Arabic digits to the Persian digits. This method will not change any other characters of the input.\n\nExample:\n```typescript\nconsole.log(this.persianNumberService.toPersian('A long text with english digits: 54484 and Arabic digits: ٤٥٦'));\n// Expected output: A long text with english digits: ۵۴۴۸۴ and Arabic digits: ۴۵۶\n```\n\n### PersianLetterService\nThis service created for validation of strings contains persian letters and converting arabic letters to the persian ones.\n\nFor reading more detailed document, you can see [related part of code document of the PersianLetterService](https://alihoseiny.github.io/ngx-persian/injectables/PersianLetterService.html).\n\n#### Adding PersianLetterService to Your Application\nFor using this service you only need to import it in the file you want to use that in it. Simple as this:\n\n`import {PersianLetterService} from 'ngx-persian';`\n\nFor _Injecting_ this service, you just need to add it in the constructor of your service or component like this:\n\n`constructor(private persianLetterService: PersianLetterService) {}`\n\nNow you can use it like other attributes of your class with `this` keyword.\n\nSo lets digging deep to the class and see what its methods do:\n\n#### containsPersian\nThis method checks if input string contains **any** persian letter or not. So if there is at least one persian letter in the input, return `true`.\n\nBe careful, digits (۱,۲,...) are not letters.\n\nExample:\n```typescript\nif (this.persianLetterService.containsPersian('Some words and numbers5454 wtih one persian letterی')) {\n  console.log('Input contains persian letters');\n} \n\nif (!this.persianLetterService.containsPersian('۴۳۵۵ fdhf 45')) {\n  console.log('Input does not contain persian letters.');\n} \n```\nFor more information you can see the [related part of code document about containsPersian method](https://alihoseiny.github.io/ngx-persian/injectables/PersianLetterService.html#containsPersian). Also for more examples, you can see the [unit tests of the containsPersian method](https://github.com/alihoseiny/ngx-persian/blob/e198c5577abca4bc634ea20ef1bccb863c8796ef/projects/ngx-persian/src/lib/Services/persian-letter.service.spec.ts#L18).\n\n#### isPersian\nThis method checks if input string contains **ONLY** persian letters or not.\n\nIn default mode, if input contains any other character (instead whitespaces and special characters explained below), returns false. But you can control behaviour of this method by second parameter, `options`.\n\n```typescript\nisPersian(value: string, options: PLOptions = {\n                                                  persianDigits: false,\n                                                  enDigits: false,\n                                                  symbols: true,\n                                                  whitespaces: true}): boolean\n```\n\noptions parameter is an object implementing [`PLOptions` interface](https://alihoseiny.github.io/ngx-persian/interfaces/PLOptions.html).\n\nYou can see possible properties of the options object, their meaning and their default value in the table below:\n\n|Property|Meaning|Default Value|\n|---|---|---|\n|persianDigits|If sets to `true`, accepts persian digits plus persian letters in the input string|`false`|\n|enDigits|If sets to `true`, accept english digits plus persian letters|`false`|\n|symbols|Accepts certain symbols plus persian letters. |`true`|\n|       |Symbols list:                                 ||                                             ||\n|       |  ?$-/:؟!~\"'^_-[]{}()%\u0026*\u003e\u003c;\n|whitespaces|If sets to `true`, accepts whitespace characters plus persian letters.|`true`|\n\nYou can use any combination of those parameters for getting the result you want.\n\nYou only need to pass parameters of options those are different from default value. Missing properties will fill with default values.\n\n\nExample:\n```typescript\nif (this.persianLetterService.isPersian('بدونفاصله'), {whitespaces: false, symbols: false}) {\n  console.log('Input string contains only persian letters, not any other thing.');\n} \n\nif (this.persianLetterService.isPersian('متن فارسی با فاصله و علائم به صورت پیش‌فرض قابل قبول است.')) {\n  console.log('Input string contains only persian letters, whitespaces and symbols.');\n} \n```\nFor more information you can see the [related part of code document about isPersian method](https://alihoseiny.github.io/ngx-persian/injectables/PersianLetterService.html#isPersian). Also for more examples, you can see the [unit tests of the isPersian method](https://github.com/alihoseiny/ngx-persian/blob/e198c5577abca4bc634ea20ef1bccb863c8796ef/projects/ngx-persian/src/lib/Services/persian-letter.service.spec.ts#L54).\n\n#### toPersian\nThis method converts arabic letters: `ك` and `ي` to persian letters: `ک` and `ی`.\n\nExample:\n```typescript\nconsole.log(this.persianLetterService.toPersian('یك متن فارسي شامل حروف عربی'));\n// Expected output: یک متن فارسی شامل حروف عربی\n```\nFor more information you can see the [related part of code document about toPersian method](https://alihoseiny.github.io/ngx-persian/injectables/PersianLetterService.html#toPersian). Also for more examples, you can see the [unit tests of the toPersian method](https://github.com/alihoseiny/ngx-persian/blob/e198c5577abca4bc634ea20ef1bccb863c8796ef/projects/ngx-persian/src/lib/Services/persian-letter.service.spec.ts#L150).\n\n### MobilePhoneNumberService\nThis service created for validation of strings contains mobile phone numbers of iranian mobile operators.\n\nYou can get operator name and validation result of a phone number by methods of this service.\n#### Adding MobilePhoneNumberService to Your Application\nFor using this service you only need to import it in the file you want to use that in it. Simple as this:\n\n`import {MobilePhoneNumberService} from 'ngx-persian';`\n\nFor _Injecting_ this service, you just need to add it in the constructor of your service or component like this:\n\n`constructor(private mobilePhoneNumberService: MobilePhoneNumberService) {}`\n\nNow you can use it like other attributes of your class with `this` keyword.\n\nSo lets digging deep to the class and see what its methods do:\n\n#### isPhoneNumberPatternValid\nThis method only checks if phoneNumber follows valid pattern. means starting by `+98` or `0`, then a `9` digit and then 9 digits. This method will not check validity of the phoneNumber code and can accept invalid strings those only locking like phone numbers and in reality are not a valid phone number.\n\nExample:\n```typescript\nif (this.mobilePhoneNumberService.isPhoneNumberPatternValid('09357413028')) {\n  console.log('phone number follows correct pattern');\n} \n\nif (!this.mobilePhoneNumberService.isPhoneNumberPatternValid('912475')) {\n  console.log('phone number is not valid.');\n} \n```\n\nFor more information you can see the [related part of code document about isPhoneNumberPatternValid method](https://alihoseiny.github.io/ngx-persian/injectables/MobilePhoneNumberService.html#isPhoneNumberPatternValid). Also for more examples, you can see the [unit tests of the  isPhoneNumberPatternValid method](https://github.com/alihoseiny/ngx-persian/blob/e198c5577abca4bc634ea20ef1bccb863c8796ef/projects/ngx-persian/src/lib/Services/mobile-phone-number.service.spec.ts#L18).\n\n#### getPhoneNumberOperator\nThis method first checks input for following correct pattern explained in the `isPhoneNumberPatternValid` method.\n\nThen, Checks all codes of all operators in [MobileCodes object](https://alihoseiny.github.io/ngx-persian/miscellaneous/variables.html#MobileCodes). IF finds a matched code, returns persian or english name of that operator from operatorsNames enum.\n\nIn default, Persian name of operator will return. For controlling language of the output, you can use second optional parameter (`nameInEnglish`) of this method.\n\nBy passing true, operator name will return in English. Default value of `nameInEnglish` parameter is `false.\n\nIf there is no recognizable operator for inputted mobile number, a [`InvalidMobileOperatorError`](https://alihoseiny.github.io/ngx-persian/classes/InvalidMobileOperatorError.html) will throw.\n\nAlso if input string does not follow correct pattern, an [`InvalidMobilePhoneNumberError`](https://alihoseiny.github.io/ngx-persian/classes/InvalidMobilePhoneNumberError.html) will throw.\n\nSupporting Mobile operator companies are listed in table below:\n\n|Operator Name in English|نام فارسی اپراتور|\n|---|---|\n|IRANCELL|ایرانسل|\n|MCI|همراه اول|\n|TALIA|تالیا|\n|RIGHTEL|رایتل|\n|SPADAN|اسپادان|\n|TKC|شبکه مستقل تلفن همراه کیش|\n|SHATEL|شاتل|\n|APTEL|آپتل|\n|AZARTEL|آذرتل|\n|SAMANTEL|سامانتل|\n|LOTUSTEL|لوتوس‌تل|\n|ANARESTAN|انارستان|\n\nWe've provided an enum named `operatorsNames` you can see it [here](https://alihoseiny.github.io/ngx-persian/miscellaneous/enumerations.html#operatorsNames).\n\nExample:\n```typescript\nconsole.log(this.mobilePhoneNumberService.getPhoneNumberOperator('09352479965'));\n// Expected output: ایرانسل\n\nconsole.log(this.mobilePhoneNumberService.getPhoneNumberOperator('+989352479965', true));\n// Expected output: irancell\n```\n\nFor more information you can see the [related part of code document about getPhoneNumberOperator method](https://alihoseiny.github.io/ngx-persian/injectables/MobilePhoneNumberService.html#getPhoneNumberOperator). Also for more examples, you can see the [unit tests of the   getPhoneNumberOperator method](https://github.com/alihoseiny/ngx-persian/blob/e198c5577abca4bc634ea20ef1bccb863c8796ef/projects/ngx-persian/src/lib/Services/mobile-phone-number.service.spec.ts#L45).\n\n#### isValidPhoneNumber\n\nIf phoneNumber follows correct pattern and has valid operator, returns true. Otherwise returns false.\n\nExample:\n```typescript\nif (this.mobilePhoneNumberService.isValidPhoneNumber('09195574410')) {\n  console.log('mobile phone number is valid.');\n}\n\nif (this.mobilePhoneNumberService.isValidPhoneNumber('09005574410')) {\n  console.log('mobile phone number is not valid.');\n}\n```\n\nFor more information you can see the [related part of code document about isValidPhoneNumber method](https://alihoseiny.github.io/ngx-persian/injectables/MobilePhoneNumberService.html#isValidPhoneNumber). Also for more examples, you can see the [unit tests of the isValidPhoneNumber method](https://github.com/alihoseiny/ngx-persian/blob/e198c5577abca4bc634ea20ef1bccb863c8796ef/projects/ngx-persian/src/lib/Services/mobile-phone-number.service.spec.ts#L103).\n\n#### normalizePhoneNumber\nRemoves +98 from the phoneNumber and replaces it with a 0 character. This method will not make any validation on the input.\n\nExample:\n```typescript\nconsole.log(this.mobilePhoneNumberService.normalizePhoneNumber('+989352479965'));\n// Expected output: 09352479965\n``` \nFor more information you can see the [related part of code document about normalizePhoneNumber method](https://alihoseiny.github.io/ngx-persian/injectables/MobilePhoneNumberService.html#normalizePhoneNumber). Also for more examples, you can see the [unit tests of the normalizePhoneNumber method](https://github.com/alihoseiny/ngx-persian/blob/e198c5577abca4bc634ea20ef1bccb863c8796ef/projects/ngx-persian/src/lib/Services/mobile-phone-number.service.spec.ts#L91).\n\n### JalaliDateValidatorService\nMethods of this Service doing validation stuff on a Jalali date. You can use this Service using DI in all around of your app for validating Jalali dates without needing to convert them to the Georgian Date.\n\n#### Adding JalaliDateValidatorService to Your Application\nFor using this service you only need to import it in the file you want to use that in it. Simple as this:\n\n`import {JalaliDateValidatorService} from 'ngx-persian';`\n\nFor _Injecting_ this service, you just need to add it in the constructor of your service or component like this:\n\n`constructor(private jalaliDateValidatorService: JalaliDateValidatorService) {}`\n\nNow you can use it like other attributes of your class with `this` keyword.\n\nSo lets digging deep to the class and see what its methods do:\n\n#### isJYearLeap\nThis method gets a Jalali year as input. It jalali year is a leap year, returns `true`. If not, returns `false`.\n\nExample:\n```typescript\nif (this.jalaliDateValidatorService.isJYearLeap(1375)) {\n  console.log('1375 is a leap year.');\n} \n\nif (!this.jalaliDateValidatorService.isJYearLeap(1397)) {\n  console.log('1397 is not a leap year.');\n} \n```\nFor more information you can see the [related part of code document about isJYearLeap method](https://alihoseiny.github.io/ngx-persian/injectables/JalaliDateValidatorService.html#isJYearLeap). Also for more examples, you can see the [unit tests of the isJYearLeap method](https://github.com/alihoseiny/ngx-persian/blob/e198c5577abca4bc634ea20ef1bccb863c8796ef/projects/ngx-persian/src/lib/JDate/jalali-date-validator.service.spec.ts#L137).\n\n#### isValidJDate\nIf Jalali date is not a valid Jalali date, return false. otherwise returns true.\nInput format of this method is:\n\n` isValidJDate(jYear, jMonth, jDay) `\n\n`jYear` is a Jalali year. `jMonth` is number of month starting from zero. `jDay` is day number starting from one.\n\nCombination of year, month and day should be a valid date in the calendar.\n\nExample:\n```typescript\nif (this.jalaliDateValidatorService.isValidJDate(1375, 11, 30)) {\n  console.log('Input is a valid Jalali date.');\n} \n\nif (!this.jalaliDateValidatorService.isValidJDate(1397, 11, 30)) {\n  console.log('Input is not a valid Jalali date.');\n}  \n```\nFor more information you can see the [related part of code document about isValidJDate method](https://alihoseiny.github.io/ngx-persian/injectables/JalaliDateValidatorService.html#isValidJDate). Also for more examples, you can see the [unit tests of the isValidJDate method](https://github.com/alihoseiny/ngx-persian/blob/e198c5577abca4bc634ea20ef1bccb863c8796ef/projects/ngx-persian/src/lib/JDate/jalali-date-validator.service.spec.ts#L10).\n\n#### isValidJDay\nChecks if day number is in valid range according to the given year and month.\n\nFirst six month of the year have 31 days. 5 next months have 30 days and last month maybe has 29 or 30 days.\n\nThis method checks is day number in the valid range of day numbers of the month in a particular year or not.\n\nExample:\n```typescript\nif (this.jalaliDateValidatorService.isValidJDay(1375, 11, 30)) {\n  console.log('Input day is valid in Jalali calendar.');\n} \n\nif (!this.jalaliDateValidatorService.isValidJDay(1397, 11, 30)) {\n  console.log('Input is not valid in Jalali calendar.');\n} \n``` \nFor more information you can see the [related part of code document about isValidJDay method](https://alihoseiny.github.io/ngx-persian/injectables/JalaliDateValidatorService.html#isValidJDay). Also for more examples, you can see the [unit tests of the isValidJDay method](https://github.com/alihoseiny/ngx-persian/blob/e198c5577abca4bc634ea20ef1bccb863c8796ef/projects/ngx-persian/src/lib/JDate/jalali-date-validator.service.spec.ts#L30).\n\n#### isValidJMonth\nChecks if jalali month is in valid range or not. In default, `jMonth` should start from zero. If you want to start month number from one instead of zero, you should make `startFromZero` parameter to false.\n\n` isValidJMonth(jMonth: number, startFromZero: boolean) `\n\nBe careful about month number. Only in this method you can choose starting month number from one or zero. In others, month number starts only from zero.\n\nExample:\n```typescript\nif (this.jalaliDateValidatorService.isValidJMonth(12, false)) {\n  console.log('Month is valid.');\n} \n\nif (!this.jalaliDateValidatorService.isValidJMonth(12)) {\n  console.log('Month is not valid');\n} \n```\nFor more information you can see the [related part of code document about isValidJMonth method](https://alihoseiny.github.io/ngx-persian/injectables/JalaliDateValidatorService.html#isValidJMonth). Also for more examples, you can see the [unit tests of the isValidJMonth method](https://github.com/alihoseiny/ngx-persian/blob/e198c5577abca4bc634ea20ef1bccb863c8796ef/projects/ngx-persian/src/lib/JDate/jalali-date-validator.service.spec.ts#L56).\n\n#### isValidJYear\nChecks if jalali year is in acceptable range or not. Acceptable range for this validator is from `-61` to `3177`.\n\n\nExample:\n```typescript\nif (this.jalaliDateValidatorService.isValidJYear(1397)) {\n  console.log('Year is valid.');\n} \n\nif (!this.jalaliDateValidatorService.isValidJYear(3179)) {\n  console.log('Year is not valid');\n} \n```\nFor more information you can see the [related part of code document about isValidJYear method](https://alihoseiny.github.io/ngx-persian/injectables/JalaliDateValidatorService.html#isValidJYear). Also for more examples, you can see the [unit tests of the isValidJYear method](https://github.com/alihoseiny/ngx-persian/blob/e198c5577abca4bc634ea20ef1bccb863c8796ef/projects/ngx-persian/src/lib/JDate/jalali-date-validator.service.spec.ts#L83).\n\n#### jMonthLength\nReturns number of days in a given month counting from 1.\n` jMonthLength(jYear: number, jMonth: number)`\n\n`jYear` is Jalali year number and `jMonth` is month number starts from zero.\n\noutput is number of days in given month. First six months of the year have 31 days. 5 next months have 30 days and last month maybe has 29 or 30 days.\n\nExample:\n```typescript\nconsole.log(this.jalaliDateValidatorService.jMonthLength(1375, 11));\n// Expected output: 30\n\nconsole.log(this.jalaliDateValidatorService.jMonthLength(1397, 0));\n// Expected output: 31\n```\nFor more information you can see the [related part of code document about jMonthLength method](https://alihoseiny.github.io/ngx-persian/injectables/JalaliDateValidatorService.html#jMonthLength).\nAlso for more examples, you can see the [unit tests of the jMonthLength method](https://github.com/alihoseiny/ngx-persian/blob/e198c5577abca4bc634ea20ef1bccb863c8796ef/projects/ngx-persian/src/lib/JDate/jalali-date-validator.service.spec.ts#L91).\n\n#### numOfJLeapYears\nReturn number of leap years passed from base year until given Jalali year.\n\nFor more information you can see the [related part of code document about numOfJLeapYears method](https://alihoseiny.github.io/ngx-persian/injectables/JalaliDateValidatorService.html#numOfJLeapYears).\nAlso for more examples, you can see the [unit tests of the numOfJLeapYears method](https://github.com/alihoseiny/ngx-persian/blob/e198c5577abca4bc634ea20ef1bccb863c8796ef/projects/ngx-persian/src/lib/JDate/jalali-date-validator.service.spec.ts#L113).\n\n### JalaliDateCalculatorService\nThis service converts Georgian date to Jalali and vase versa. You can use all of the methods as static methods.\n\n\n#### Adding JalaliDateCalculatorService to Your Application\nFor using this service you only need to import it in the file you want to use that in it. Simple as this:\n\n`import {JalaliDateCalculatorService} from 'ngx-persian';`\n\nFor _Injecting_ this service, you just need to add it in the constructor of your service or component like this:\n\n`constructor(private jalaliDateCalculatorService: JalaliDateCalculatorService) {}`\n\nNow you can use it like other attributes of your class with `this` keyword.\n\nJalaliDateValidatorService injected into this service. So if you want to create an instance of this service and don't want to use DI, you should pass an instance of that service in it. But if you are using DI as described before, you don't need to do anything at all.\n\nSo lets digging deep to the class and see what its methods do:\n\n#### convertToGeorgian\nConverts a valid jalali date to a [javascript `Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) object representing a equivalent Georgian date.\nthis method looking like:\n\n`convertToGeorgian(jYear: number, jMonth: number, jDay: number)`\n\n`jYear` is a full Jalali year like 1397.\n`jMonth` is month number starting from zero.\n`jDay` in day number starting from one.\n\nExample:\n```typescript\nthis.jalaliDateCalculator.convertToGeorgian(1397, 11, 22);\n// Expecting output of this line is: Date(2019, 2, 13);\n``` \n\nFor more information you can see the [related part of code document about convertToGeorgian method](https://alihoseiny.github.io/ngx-persian/injectables/JalaliDateCalculatorService.html#convertToGeorgian).\nAlso for more examples, you can see the [unit tests of the convertToGeorgian method](https://github.com/alihoseiny/ngx-persian/blob/e198c5577abca4bc634ea20ef1bccb863c8796ef/projects/ngx-persian/src/lib/JDate/jalali-date-calculator.service.spec.ts#L139).\n\n#### convertToJalali\nThis method converts Georgian date to the jalali date. Output is an object implementing [SimpleDateInterface](https://alihoseiny.github.io/ngx-persian/interfaces/SimpleDateInterface.html).\n\nATTENTION: month number starts from 0, but day number starts from 1. Just like native javascript Date object.\n\nInput of this method is a native javascript `Date` object.\n\nExample:\n```typescript\nconst jalali = this.jalaliDateCalculator.convertToJalali(new Date(2019, 2, 13));\nconsole.log(jalali.year); // Expected output: 1397\nconsole.log(jalali.month) // Expected output: 11\nconsole.log(jalali.day) // Expected output: 22\n```\nFor more information you can see the [related part of code document about convertToJalali method](https://alihoseiny.github.io/ngx-persian/injectables/JalaliDateCalculatorService.html#convertToJalali).\nAlso for more examples, you can see the [unit tests of the convertToJalali method](https://github.com/alihoseiny/ngx-persian/blob/e198c5577abca4bc634ea20ef1bccb863c8796ef/projects/ngx-persian/src/lib/JDate/jalali-date-calculator.service.spec.ts#L122).\n\n#### createGDateFromDays\nCreates a javascript Date object from number of passed days in Georgian calendar representing Georgian date.\n\nExample:\n```typescript\nconsole.log(this.jalaliDateCalculator.createGDateFromDays(2458736));\n// Expected output: Date(2019, 8, 9)\n```\nFor more information you can see the [related part of code document about createGDateFromDays method](https://alihoseiny.github.io/ngx-persian/injectables/JalaliDateCalculatorService.html#createGDateFromDays).\nAlso for more examples, you can see the [unit tests of the createGDateFromDays method](https://github.com/alihoseiny/ngx-persian/blob/e198c5577abca4bc634ea20ef1bccb863c8796ef/projects/ngx-persian/src/lib/JDate/jalali-date-calculator.service.spec.ts#L28).\n\n#### firstDayOfJYearInMarch\nFirst day of the Farvardin month in Jalali calendar is in March month. This method returns the day number of starting day of new jalali year in March.\n\nThe day number starts from 1 not zero and is equal to the real numbers in the calendar.\n\nExample:\n```typescript\nconsole.log(this.jalaliDateCalculator.firstDayOfJYearInMarch(1398));\n// Expected output: 21\n```\nFor more information you can see the [related part of code document about firstDayOfJYearInMarch method](https://alihoseiny.github.io/ngx-persian/injectables/JalaliDateCalculatorService.html#firstDayOfJYearInMarch).\nAlso for more examples, you can see the [unit tests of the firstDayOfJYearInMarch method](https://github.com/alihoseiny/ngx-persian/blob/e198c5577abca4bc634ea20ef1bccb863c8796ef/projects/ngx-persian/src/lib/JDate/jalali-date-calculator.service.spec.ts#L108).\n\n#### georgianYearToJalaliYear\nConverts georgian year to the jalali year. Output year is the jalali year that start within the Georgian year.\n\nExample:\n```typescript\nconsole.log(this.jalaliDateCalculator.georgianYearToJalaliYear(2018));\n// Expected output: 1397\n```\nFor more information you can see the [related part of code document about georgianYearToJalaliYear method](https://alihoseiny.github.io/ngx-persian/injectables/JalaliDateCalculatorService.html#georgianYearToJalaliYear).\n\n#### jalaliYearToGeorgianYear\nConverts jalali year number to the georgian year. Output year is the georgian year that jalali year starts within it, not the year that starts in the winter of jalali year.\n\nExample:\n```typescript\nconsole.log(this.jalaliDateCalculator.jalaliYearToGeorgianYear(1397));\n// Expected output: 2018\n```\nFor more information you can see the [related part of code document about jalaliYearToGeorgianYear method](https://alihoseiny.github.io/ngx-persian/injectables/JalaliDateCalculatorService.html#jalaliYearToGeorgianYear).\n\n#### numberOfPassedGDays\nCalculates the Julian Day number from Gregorian or Julian calendar dates.\n\nInput value of this method is a javascript `Date` object.\n\nExample:\n```typescript\nconst dateObj = new Date(2019, 8, 9);\nconsole.log(this.jalaliDateCalculator.numberOfPassedGDays(dateObj));\n// Expected output: 2458736\n```\nFor more information you can see the [related part of code document about numberOfPassedGDays method](https://alihoseiny.github.io/ngx-persian/injectables/JalaliDateCalculatorService.html#numberOfPassedGDays).\nAlso for more examples, you can see the [unit tests of the numberOfPassedGDays method](https://github.com/alihoseiny/ngx-persian/blob/e198c5577abca4bc634ea20ef1bccb863c8796ef/projects/ngx-persian/src/lib/JDate/jalali-date-calculator.service.spec.ts#L10).\n\n#### numberOfPassedJDays\nReturns number of passed days from source day in jalali calendar to the given jalali date.\n\nmethod declaration:\n`numberOfPassedJDays(jYear: number, jMonth: number, jDay: number) `\n\n`jYear` is a full Jalali year like 1397.\n`jMonth` is month number starting from zero.\n`jDay` in day number starting from one.\n\nExample:\n```typescript\nconsole.log(this.jalaliDateCalculator.numberOfPassedJDays(1397, 0, 1));\n// Expected output: 2458199\n```\nFor more information you can see the [related part of code document about numberOfPassedJDays method](https://alihoseiny.github.io/ngx-persian/injectables/JalaliDateCalculatorService.html#numberOfPassedJDays).\nAlso for more examples, you can see the [unit tests of the numberOfPassedJDays method](https://github.com/alihoseiny/ngx-persian/blob/e198c5577abca4bc634ea20ef1bccb863c8796ef/projects/ngx-persian/src/lib/JDate/jalali-date-calculator.service.spec.ts#L61).\n\n#### numOfGLeapYears\nThis function returns number of passed leap years from AD 621 until `targetGYear`.\n\nExample:\nExample:\n```typescript\nconsole.log(this.jalaliDateCalculator.numOfGLeapYears(2018));\n// Expected output: 339\n```\nFor more information you can see the [related part of code document about numOfGLeapYears method](https://alihoseiny.github.io/ngx-persian/injectables/JalaliDateCalculatorService.html#numOfGLeapYears).\nAlso for more examples, you can see the [unit tests of the numOfGLeapYears method](https://github.com/alihoseiny/ngx-persian/blob/e198c5577abca4bc634ea20ef1bccb863c8796ef/projects/ngx-persian/src/lib/JDate/jalali-date-calculator.service.spec.ts#L93).\n\n## Jalali Date\nWe always had problems with Jalali dates. Built-in javascript `Date` object created for Georgian date and everything has been built for that object.\n\nNow, in **ngx-persian**, we solved the problem for ever.\n\nWe provided a class named `JDate`. This class implemented [javascript native `Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date). So you have access to all the methods and behaviours of that object, now in Jalali.\n\nAlso, you can use objects of `JDate` everywhere accepts javascript native `Date` object.\n\nThat means you can use all libraries, services and ... those are working with javascript `Date` object, with Jalali date. without any need for changing things or writing them for Jalali date from scratch.\n\nThe `JDate` object is timezone aware. By default, it calculates all dates in the \"Asia/Tehran\" timezone. But you can pass any valid timezone name as the last parameter of the constructor.\n\nThis is the end of bad days for Iranian developers.\n\n\n\n### How to add JDate to your project?\nFor using `JDate`, you only need to import it in the file you are working on it:\n\n`import {JDate} from 'ngx-persian';`\n\n### How to create instances of JDate\nThere are many ways to create a Jalali Date object for your convenience.\n1. getting current date and time by creating an instance without any parameter: `new JDate()`\n2. Creating `JDate` object from a jalali date string as described in the\n   [`pars` method document](https://alihoseiny.github.io/ngx-persian/classes/JDate.html#parse), you can pass that string as\n   first parameter and leave others empty. `new JDate('11 دی 1348 00:00:00')`\n3. Creating `JDate` object from number of passed milliseconds from UNIX epoch: `new JDate(-12600000)`\n4. Creating `JDate` object from a Georgian Date object and convert that date to the Jalali date effortlessly: `new JDate(new Date(2018, 1, 1))`\n5. Creating JDate object from date and time values: `new JDate(1397, 12, 25)` or `new JDate(1397, 12, 25, 12, 32, 45, 123)`\n\nAs I said, This class implements entire `Date` object, so there are many methods, and you can do anything you could do with javascript `Date` ,\nplus some additional methods for simpler use like [`format` method](https://alihoseiny.github.io/ngx-persian/classes/JDate.html#format) that formats date and time in desired pattern.\n\n[**You can see complete document of all methods of this class by clicking on this text**.](https://alihoseiny.github.io/ngx-persian/classes/JDate.html)\n\n[Also you can get more clear vision of each method by viewing unit test of JDate class here.](https://github.com/alihoseiny/ngx-persian/blob/master/projects/ngx-persian/src/lib/JDate/jdate.spec.ts)\n\nBy using this class in your app, you never need another help for working and validating Jalali date and time.\n\n## NationalCodeService\nYou can use this service for validating Iranian national code (number) And finding out if user input is a correct National code or not.\nFor reading more detailed document, you can see [related part of the code document of the NationalCodeService] (https://alihoseiny.github.io/ngx-persian/injectables/NationalCodeService.html)\n\n### Adding NationalCodeService to Your Application\nFor using this service you only need to import it in the file you want to use that in it. Simple as this:\n\n`import {NationalCodeService} from 'ngx-persian';`\n\nFor Injecting this service, you just need to add it in the constructor of your service or component like this:\n\n`constructor(private nationalCodeService: NationalCodeService) {}`\n\nNow you can use it like other attributes of your class with this keyword.\n\nSo lets digging deep to the class and see what its methods do:\n\n### normalize\nThis method normalizes inputs for being a 10-digit string.\n\nThis method removes whitespaces from sides of the input and adds zero character at the beginning of the input until the length of the result reach to 10.\n\nIf Input length is shorter than 8 or longer than 10, an [`InvalidNationalCodeError](https://alihoseiny.github.io/ngx-persian/classes/) will throw.\n\nExample:\n```typescript\nconsole.log(this.nationalCodeService(15234756));\n// Expected output is: '0015234756'\n\nconsole.log(this.nationalCodeService('015234756'));\n// Expected output is: '0015234756'\n\nconsole.log(this.nationalCodeService('0015234756'));\n// Expected output is: '0015234756'\n\ntry {\n  this.nationalCodeService('34756');\n} catch (e) {\n  console.log('Input length is less than 8 and an InvalidNationalCodeError throw');\n}\n\n```\n\nFor more information you can see [the related part of code document about normalize](https://alihoseiny.github.io/ngx-persian/injectables/NationalCodeService.html#normalize) method. Also for more examples, you can see the [unit tests of the normalize method](https://github.com/alihoseiny/ngx-persian/tree/e198c5577abca4bc634ea20ef1bccb863c8796ef/projects/ngx-persian/src/lib/Services/national-code.service.spec.ts#L10).\n\n### isValid\nThis method first normalizes the input using normalize method and implicitly checks input length, So you DO NOT NEED to normalize input before, but this will not make any bad effect.\n\nThen checks the validity of the input for being a valid Iranian national code. If it's a valid code, return true. Otherwise returns false.\n\nExample:\n\n```typescript\nconsole.log(this.isValid(2365478824));\n// Expected output: true\n\nconsole.log(this.isValid(7731689951));\n// Expected output: false\n``` \n\nFor more information you can see [the related part of code document about isValid](https://alihoseiny.github.io/ngx-persian/injectables/NationalCodeService.html#isValid) method. Also for more examples, you can see the [unit tests of the normalize method](https://github.com/alihoseiny/ngx-persian/tree/e198c5577abca4bc634ea20ef1bccb863c8796ef/projects/ngx-persian/src/lib/Services/national-code.service.spec.ts#L60).\n\n## Validators\nThere are different validators for reactive forms. You can use them in your forms for validating data related to Iran or Farsi language without any need for writing new code.\n\n### persianNumbersValidator\nReactive form validator that checks form control value contains only persian numbers.\n\n#### Adding persianNumbersValidator to your code\nFirst you should add validator in your component:\n\n`import {persianNumbersValidator} from 'ngx-persian';`\n\nThen you should add it to validators list of desired `FormControl`. That's it.\nYou can see the example usage in below GIF:\n![Angular form persian number validator](https://github.com/alihoseiny/ngx-persian/raw/master/Usage%20Examples/persianNumbersValidator.gif \"Angular form persian number validator\")\n\n**Still have questions?** see the [related part of example app](https://github.com/alihoseiny/ngx-persian/blob/master/TestApplication/src/app/validator-functions/validator-functions.component.ts)\n\nFor more information you can see the [related part of code document about persianNumbersValidator](https://alihoseiny.github.io/ngx-persian/miscellaneous/functions.html#persianNumbersValidator).\nAlso for more examples, you can see the [unit tests of the persianNumbersValidator](https://github.com/alihoseiny/ngx-persian/blob/e198c5577abca4bc634ea20ef1bccb863c8796ef/projects/ngx-persian/src/lib/Validators/persian-validators.spec.ts#L24).\n\n### persianNumbersValidator\nReactive form validator that checks form control value contains only persian numbers.\n\n#### Adding  persianLettersValidator to your code\nFirst you should add validator in your component:\n\n`import {persianLettersValidator} from 'ngx-persian';`\n\nReactive form validator that checks form control value contains only persian letters and allowed characters in the options parameter.\n\nThis validator gets an optional options parameter as `isPersian` method of `PersianLetterService`.\n\nFor validating only persian letters without any other character (default behavior), you can add validator to your `FormControl` like it:\n\n`persianLettersValidator()`\n\nYou can see the example usage in below GIF:\n![Angular form only persian letters validator](https://github.com/alihoseiny/ngx-persian/raw/master/Usage%20Examples/persianLettersValidator-only%20letters.gif \"Angular form only persian letters validator\")\n\nFor validating only persian letters and whitespaces, you can add validator to your `FormControl` like it:\n\n`persianLettersValidator({whitespaces: true})`\n\nYou can see the example usage in below GIF:\n![Angular form persian letters and whitespaces validator](https://github.com/alihoseiny/ngx-persian/raw/master/Usage%20Examples/persianLettersValidator-letters%20and%20whitespaces.gif \"Angular form persian letters and whitespaces validator\")\n\nFor validating only persian letters and english digits, you can add validator to your `FormControl` like it:\n\n`persianLettersValidator({enDigits: true})`\n\nYou can see the example usage in below GIF:\n![Angular form persian letters and english digits validator](https://github.com/alihoseiny/ngx-persian/raw/master/Usage%20Examples/persianLettersValidator-letters%20and%20en%20digits.gif \"Angular form persian letters and english digits validator\")\n\nFor validating only persian letters and persian digits, you can add validator to your `FormControl` like it:\n\n`persianLettersValidator({persianDigits: true})`\n\nYou can see the example usage in below GIF:\n![Angular form persian letters and persian digits validator](https://github.com/alihoseiny/ngx-persian/raw/master/Usage%20Examples/persianLettersValidator-letters%20and%20fa%20digits.gif \"Angular form persian letters and persian digits validator\")\n\nFor validating only persian letters and symbols, you can add validator to your `FormControl` like it:\n\n`persianLettersValidator({symbols: true})`\n\nYou can see the example usage in below GIF:\n![Angular form persian letters and symbols validator](https://github.com/alihoseiny/ngx-persian/raw/master/Usage%20Examples/persianLettersValidator-letters%20and%20symbols.gif \"Angular form persian letters and symbols validator\")\n\nYou can validate inputs with any combination of these options.\n\n**Still have questions?** see the [related part of example app](https://github.com/alihoseiny/ngx-persian/tree/master/TestApplication/src/app/validator-functions)\n\nFor more information you can see the [related part of code document about persianLettersValidator](https://alihoseiny.github.io/ngx-persian/miscellaneous/functions.html#persianLettersValidator).\nAlso for more examples, you can see the [unit tests of the persianLettersValidator](https://github.com/alihoseiny/ngx-persian/blob/e198c5577abca4bc634ea20ef1bccb863c8796ef/projects/ngx-persian/src/lib/Validators/persian-validators.spec.ts#L49).\n\n## Directives\nFor template-driven forms, we also provided Two directives those using above validator functions.\n\nRead [code document of PersianLetterDirective](https://alihoseiny.github.io/ngx-persian/directives/PersianLetterDirective.html) or [code document of PersianNumbersDirective].(https://alihoseiny.github.io/ngx-persian/directives/PersianNumbersDirective.html)\n\n# Contribution\nWe want to keep this library fresh and useful for all Iranian developers. So we need your help for adding new features, fixing bugs and adding more documents.\n\n## How You can Help All Iranian Angular Developers?\nYou are wondering how you can contribute in this project? Here is a list of what you can do:\n1. You did anything useful and special for Iranian apps? So you can add that in this library and save other developers time.\n2. You think number of tests for some part of this library is not enough? So you can write more tests.\n3. Documents are not enough? You can help us by adding more documents.\n4. Current code could be better? You can make this cleaner or faster.\n5. Currently, there is a problem for running tests in timezones different from Tehran. You can solve it!\n\nYou should follow these steps for contributing in this project:\n## 1. Getting the Repository\nFor contributing, first fork the repository. Then create your branch and start coding.\n## 2. Add Tests\nWe are following TDD guides for developing this library, So you **SHOULD** add tests first and then add your code.\n## 3. Write the Dock\nAll codes should have complete in-code document following JSDoc syntax. Plus you should re-generate the code document using [compodoc](https://compodoc.app).\nFor generating documents, you should run following command in the _project_ directory:\n`npm run generate-docs`\n\nAlso you should add some documents about how to using a feature in the `README.md` file.\n\n## 4. Create A Pull Request\nNow you are done and want to add your code. So come here and create a new pull request. Please make pull request message complete and useful. Also you should keep all commit messages in your branch meaningful and useful.\n\nThank you for your contribution and make life easier for Iranian Angular developers.\n\n# There is any problem?\nIf you have questions, find some bugs or need some features, you can open an issue and tell us. For some strange reasons this is not possible? so contact me by this email: `salam@alihoseiny.ir`.\n# Citations\nI should say a thank you to developers of [jalaali js](https://github.com/jalaali/jalaali-js) and it's implementation in Type script: [jalaali Helper in Typescript](https://github.com/sijad/ts-jalaali/) Because I used their code in Jalali services.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falihoseiny%2Fngx-persian","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falihoseiny%2Fngx-persian","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falihoseiny%2Fngx-persian/lists"}