{"id":15036937,"url":"https://github.com/persian-tools/persian-tools","last_synced_at":"2025-05-14T00:08:28.562Z","repository":{"id":37050688,"uuid":"137736003","full_name":"persian-tools/persian-tools","owner":"persian-tools","description":"An anthology of a variety of tools for the Persian language in javascript","archived":false,"fork":false,"pushed_at":"2025-05-12T19:05:41.000Z","size":4994,"stargazers_count":1118,"open_issues_count":31,"forks_count":122,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-05-12T20:27:15.926Z","etag":null,"topics":["card-number","code-melli","code-melli-validator","convert-numbers","convert-persian-number","english-number-to-persian","fuzzy-matching","iban","iranian-national-id","number-to-words","persian-characters","persian-language","persian-words-to-number","remove-commas","sheba","sheba-validator","verify-bank-nunber","verify-national-id","words-to-numbers"],"latest_commit_sha":null,"homepage":"http://persian-tools.js.org/","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/persian-tools.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-06-18T10:00:57.000Z","updated_at":"2025-05-05T17:17:23.000Z","dependencies_parsed_at":"2024-03-15T12:30:04.785Z","dependency_job_id":"11c1456c-e407-4619-8c5a-ae5f273be2a3","html_url":"https://github.com/persian-tools/persian-tools","commit_stats":{"total_commits":486,"total_committers":45,"mean_commits":10.8,"dds":0.7263374485596708,"last_synced_commit":"0d12c21b00f475c1301856f1148c836750fdcfc0"},"previous_names":["ali-master/persian-tools"],"tags_count":55,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/persian-tools%2Fpersian-tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/persian-tools%2Fpersian-tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/persian-tools%2Fpersian-tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/persian-tools%2Fpersian-tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/persian-tools","download_url":"https://codeload.github.com/persian-tools/persian-tools/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254043996,"owners_count":22005055,"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","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":["card-number","code-melli","code-melli-validator","convert-numbers","convert-persian-number","english-number-to-persian","fuzzy-matching","iban","iranian-national-id","number-to-words","persian-characters","persian-language","persian-words-to-number","remove-commas","sheba","sheba-validator","verify-bank-nunber","verify-national-id","words-to-numbers"],"created_at":"2024-09-24T20:32:48.758Z","updated_at":"2025-05-14T00:08:28.522Z","avatar_url":"https://github.com/persian-tools.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\t\u003cp align=\"center\"\u003e\n\t\t\u003cimg src=\"./images/logo.png\" width=\"200\" alt=\"PersianTools logo\" /\u003e\n\t\u003c/p\u003e\n\t\u003ch1 align=\"center\"\u003ePersian tools\u003c/h1\u003e\n\t\u003cp align=\"center\"\u003eA standalone, \u003cstrong\u003elibrary-agnostic\u003c/strong\u003e JavaScript utility for Persian language features.\u003c/p\u003e\n\n![CI/CD](https://github.com/persian-tools/persian-tools/workflows/Continuous%20Integration/badge.svg)\n[![codecov](https://codecov.io/gh/persian-tools/persian-tools/branch/master/graph/badge.svg)](https://codecov.io/gh/persian-tools/persian-tools)\n[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/persian-tools/persian-tools/blob/master/LICENSE)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-orange.svg)](https://github.com/persian-tools/persian-tools/compare)\n[![CodeFactor](https://www.codefactor.io/repository/github/persian-tools/persian-tools/badge)](https://www.codefactor.io/repository/github/persian-tools/persian-tools)\n![GitHub contributors](https://img.shields.io/github/contributors/persian-tools/persian-tools.svg)\n\n\u003c/div\u003e\n\u003chr /\u003e\n\n## Features\n\n- [Convert Persian words to the number](#convert-persian-words-to-the-number).\n- [Convert Numbers to Persian words](#convert-numbers-to-persian-words).\n- [Add and remove commas to numbers](#add-and-remove-commas).\n- [Convert Persian numbers to Arabic or English numbers and vice versa](#convert-persian-numbers-to-arabic-or-english-numbers-and-vice-versa).\n- [Validate Iranian national number(code-e Melli)](#validate-iranian-national-numbercode-e-melli).\n- [Validate Iranian legal id(shenase hoghoghi)](#validate-iranian-legal-idshenase-hoghoghi).\n- [Find city and province name by national code(code-e Melli)](#find-city-and-province-name-by-national-idcode-e-melli).\n- [Bill calculator](#bill-calculator).\n- [Check Iranian Sheba(IBAN) validation and recognize bank information by sheba code](#iranian-shebaiban).\n- [Validate Bank card number](#bank-number-validation-and-get-the-name-of-the-bank-by-bank-account-number).\n- [Find Bank's name by Card number](#bank-number-validation-and-get-the-name-of-the-bank-by-bank-account-number).\n- [Validate the correctness of the text of the Persian language and clear the Arabic letters in the Persian text](#validate-the-correctness-of-the-text-of-the-persian-language-and-clear-the-arabic-letters-in-the-persian-text).\n- [Fix Persian characters in URL](#fix-persian-characters-in-url).\n- [Fix Persian zero-width non-joiner(Replace spaces by half-space)](#fix-persian-zero-width-non-joinerreplace-spaces-by-half-space)\n- [Convert Jalaali date-time into a time ago](#convert-jalaali-date-time-into-a-time-ago)\n- [Get the Remaining Time of the Date](#get-the-remaining-time-of-the-date)\n- [Validate and find information of phone number](#validate-and-find-information-of-phone-number).\n- [Find capital city by province name ](#find-capital-city-by-province-name)\n- [Find province from coordinate ](#find-province-from-coordinate)\n\n## Getting started\n\nThere are two main ways to get PersianTools.js in your JavaScript project:\nvia \u003ca href=\"https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_JavaScript_within_a_webpage\" target=\"_blank\"\u003escript tags\u003c/a\u003e \u003cstrong\u003eor\u003c/strong\u003e by installing it from \u003ca href=\"https://www.npmjs.com/\" target=\"_blank\"\u003eNPM\u003c/a\u003e\nand using a build tool like \u003ca href=\"https://parceljs.org/\" target=\"_blank\"\u003eParcel\u003c/a\u003e,\n\u003ca href=\"https://webpack.js.org/\" target=\"_blank\"\u003eWebPack\u003c/a\u003e, or \u003ca href=\"https://rollupjs.org/guide/en\" target=\"_blank\"\u003eRollup\u003c/a\u003e.\n\n### via Script Tag\n\nAdd the following code to an HTML file:\n\n```html\n\u003chtml\u003e\n\t\u003chead\u003e\n\t\t\u003c!-- Load PersianTools.js --\u003e\n\t\t\u003cscript src=\"https://cdn.jsdelivr.net/npm/@persian-tools/persian-tools/build/persian-tools.umd.js\"\u003e\u003c/script\u003e\n\n\t\t\u003c!-- Place your code in the script tag below. You can also use an external .js file --\u003e\n\t\t\u003cscript type=\"text/javascript\"\u003e\n\t\t\t// Notice there is no 'import' statement. 'all persian-tools functions like digitsEnToFa, etc...' is available on the index-page\n\t\t\t// because of the script tag above.\n\n\t\t\t// Takes a string made of English digits only, and returns a string that represents the same number but with Persian digits\n\t\t\tvar convertToFa = PersianTools.digitsEnToFa(1234567);\n\n\t\t\t// etc...\n\t\t\u003c/script\u003e\n\t\u003c/head\u003e\n\n\t\u003cbody\u003e\u003c/body\u003e\n\u003c/html\u003e\n```\n\nOpen up that html file in your browser, and the code should run!\n\n### Install\n\nInstall the PersianTools to your project using \u003ca href=\"https://yarnpkg.com/en/\" target=\"_blank\"\u003eyarn\u003c/a\u003e \u003cem\u003eor\u003c/em\u003e \u003ca href=\"https://docs.npmjs.com/cli/npm\" target=\"_blank\"\u003enpm\u003c/a\u003e. \u003cb\u003eNote:\u003c/b\u003e Because\nwe use ES2017 syntax (such as `import`), this workflow assumes you are using a modern browser, or a bundler/transpiler\nto convert your code to something older browsers understand.\n\n```bash\n$ npm install --save @persian-tools/persian-tools\n```\n\nor\n\n```bash\n$ yarn add @persian-tools/persian-tools\n```\n\n### Simple usage\n\n```javascript\nimport * as persianTools from \"@persian-tools/persian-tools\";\n// or\nimport { digitsEnToFa } from \"@persian-tools/persian-tools\";\n\n// Takes a string made of English digits only, and returns a string that represents the same number but with Persian digits\nconst convertedToFa = persianTools.digitsEnToFa(1234567);\n// or\nconst convertedToFa = digitsEnToFa(1234567);\n```\n\n## Usage\n\nLet's take a look at what an example test case would look like using Persian-tools.\n\n### Convert Persian words to the number\n\n| Options                                    | Description                                                                         | Default |\n| ------------------------------------------ | ----------------------------------------------------------------------------------- | ------- |\n| `fuzzy`**(Beta)**                          | Fix typo in the Persian words by using **levenshtein** algorithm                    | `false` |\n| `digits`                                   | Result will be converted to the English or Persian digits                           | `en`    |\n| `addCommas`                                | Commas will be added to the Result                                                  | `false` |\n| `autoConvertDigitsToEn`**(New)**           | Automatically convert the digits to English digits if the input is a Persian number | `false` |\n| `autoConvertArabicCharsToPersian`**(New)** | Automatically convert the Arabic characters to Persian characters                   | `false` |\n\n- Convert with no option\n\n```javascript\nimport { wordsToNumber } from \"@persian-tools/persian-tools\";\n\nwordsToNumber(\"منفی سه هزارمین\"); // -3000\nwordsToNumber(\"منفی سه هزارم\"); // -3000\nwordsToNumber(\"منفی سه هزار\"); // -3000\nwordsToNumber(\"سه هزار دویست و دوازده\"); // 3212\nwordsToNumber(\"دوازده هزار بیست دو\"); // 12022\n```\n\n- Digits converter\n\n```js\nwordsToNumber(\"منفی سه هزارمین\", { digits: \"fa\" }); // \"-۳۰۰۰\"\nwordsToNumber(\"دوازده هزار بیست دو\", { digits: \"fa\" }); // ۱۲۰۲۲\n```\n\n- Add commas\n\n```js\nwordsToNumber(\"منفی سه هزارمین\", { addCommas: true }); // \"-3,000\"\nwordsToNumber(\"دوازده هزار بیست دو\", { addCommas: true }); // \"12,022\"\n```\n\n- Fuzzy typo fixer(`v1.5.0`):\n\n```javascript\nimport { WordsToNumber } from \"@persian-tools/persian-tools\";\n\nwordsToNumber(\"یگصد و بنجاه هزار\", { fuzzy: true }); // \"150000\"\nwordsToNumber(\"دویشت ر بیشت هزار\", { fuzzy: true }); // \"220000\"\nwordsToNumber(\"منقی ضد\", { fuzzy: true }); // \"-100\"\n```\n\n### Convert Numbers to Persian words\n\n```javascript\nimport { numberToWords } from \"@persian-tools/persian-tools\";\n\nnumberToWords(500443); // \"پانصد هزار و چهار صد و چهل و سه\"\nnumberToWords(\"500,443\"); // \"پانصد هزار و چهار صد و چهل و سه\"\nnumberToWords(\"500,443\", { ordinal: true }); // \"پانصد هزار و چهار صد و چهل و سوم\"\nnumberToWords(30000000000); // \"سی میلیارد\"\n```\n\n**NOTE:** This function supports the largest safe integer (9007199254740991 / 2^53 - 1)\n\n### Add and remove commas\n\n```javascript\nimport { addCommas, removeCommas } from \"@persian-tools/persian-tools\";\n\naddCommas(30000000); // \"30,000,000\"\n\nremoveCommas(\"30,000,000\"); // 30000000\n```\n\n### Convert Persian numbers to Arabic or English numbers and vice versa\n\n```javascript\nimport {\n\tdigitsArToFa,\n\tdigitsArToEn,\n\tdigitsEnToFa,\n\tdigitsFaToEn,\n\tdigitsEnToAr,\n\tdigitsFaToAr,\n} from \"@persian-tools/persian-tools\";\n\ndigitsArToFa(\"۸۹123۴۵\"); // \"۸۹123۴۵\"\n\ndigitsArToEn(\"٨٩123٤٥\"); // \"8912345\"\n\ndigitsEnToFa(\"123۴۵۶\"); // \"۱۲۳۴۵۶\"\n\ndigitsEnToAr(\"123٤٥٦\"); // \"۱۲۳٤٥٦\"\n\ndigitsFaToAr(\"۱۷۸۲۳۴۰۵۶۹\"); // ١٧٨٢٣٤٠٥٦٩\n```\n\n### Validate Iranian national number(code-e Melli)\n\n| Options                | Description                                                                       | Default |\n| ---------------------- | --------------------------------------------------------------------------------- | ------- |\n| `checkPrefix`**(New)** | Whether to check the first 3 digits against a predefined list of valid city codes | `true`  |\n\n```javascript\nimport { verifyIranianNationalId, getPlaceByIranNationalId } from \"@persian-tools/persian-tools\";\n\nverifyIranianNationalId(\"0499370899\"); // true\nverifyIranianNationalId(\"0684159415\"); // false\n```\n\n### Validate Iranian legal id(shenase hoghoghi)\n\n```javascript\nimport { verifyIranianLegalId } from \"@persian-tools/persian-tools\";\n\nverifyIranianLegalId(10380285692); // false\nverifyIranianLegalId(10380284790); // true\n```\n\n### Find city and province name by national-id(code-e Melli)\n\n```javascript\ngetPlaceByIranNationalId(\"0084575948\").city; // \"تهران مرکزی\"\n```\n\n### Bank number validation and get the name of the bank by bank account number\n\n```javascript\nimport { verifyCardNumber, getBankNameFromCardNumber } from \"@persian-tools/persian-tools\";\n\nverifyCardNumber(6037701689095443); // true\n\ngetBankNameFromCardNumber(\"6219861034529007\"); // \"بانک سامان\"\n```\n\n### Validate the correctness of the text of the Persian language and clear the Arabic letters in the Persian text.\n\n```javascript\nimport { isPersian, hasPersian, toPersianChars } from \"@persian-tools/persian-tools\";\n\nisPersian(\"این یک متن فارسی است؟\"); // true\nisPersian(\"Lorem Ipsum Test\"); // false\nisPersian(\"هل هذا نص فارسي؟\"); // false\n\nhasPersian(\"This text includes فارسی\"); // true\n\ntoPersianChars(\"علي\"); // علی\n```\n\n**Note**: You can pass `2` more options to `isPersian` to customize it as your needs:\n\n- `isComplex`: If you pass `true`, Then it accepts some of regular arabic characters which are commons in persian texts.(default is `false`)\n- `trimPattern`: By default the function skips some of characters e.g. `\"'-+()؟.` and `whitespaces`. You can pass your own customized `regex` as you need.\n\n### Fix Persian characters in URL.\n\n```javascript\nimport { urlFix } from \"@persian-tools/persian-tools\";\n\nurlFix(\n\t\"https://fa.wikipedia.org/wiki/%D9%85%D8%AF%DB%8C%D8%A7%D9%88%DB%8C%DA%A9%DB%8C:Gadget-Extra-Editbuttons-botworks.js\",\n); // \"https://fa.wikipedia.org/wiki/مدیاویکی:Gadget-Extra-Editbuttons-botworks.js\"\nurlFix(\"https://en.wikipedia.org/wiki/Persian_alphabet\"); // \"https://en.wikipedia.org/wiki/Persian_alphabet\",\nurlFix(\"Sample Text\"); // \"Sample Text\"\n```\n\n### Bill calculator\n\n| Method                    | Description                                                                                               | Return type |\n| ------------------------- | --------------------------------------------------------------------------------------------------------- | ----------- |\n| `getResult`               | Result of bill calculated information                                                                     | BillResult  |\n| `getAmount`               | Calculate Bill amount by payment id and bill id which entered by the Bill constructor                     | number      |\n| `getBillType`             | Get Bill provider type name                                                                               | BillTypes   |\n| `getBarcode`              | Calculate and get Bill's barcode                                                                          | `string`    |\n| `verificationBill`        | Validate entered both Bill id and payment id, and return true if bill id and payment id relation was true | boolean     |\n| `verificationBillId`      | Validate entered Bill id                                                                                  | `boolean`   |\n| `verificationBillPayment` | Validate entered Bill payment id                                                                          | `boolean`   |\n\n```js\nimport { Bill } from \"@persian-tools/persian-tools\";\n\n// Calculate bill amount by bill id and payment id\n// Convert to Iranian Rials\n// Return bill amount by Toman(Iranian currency type) by default\nnew Bill({ billId: 1117753200140, paymentId: 12070160, currency: \"rial\" }).getResult().amount; // 120000\n\n// Find Bill's type by bill id and payment id\nnew Bill({ billId: 7748317800142, paymentId: 1770160 }).getResult().type; // تلفن ثابت\nnew Bill({ billId: 9174639504124, paymentId: 12908197 }).getResult().type; // برق\nnew Bill({ billId: 2050327604613, paymentId: 1070189 }).getResult().type; // آب\nnew Bill({ billId: 9100074409151, paymentId: 12908190 }).getResult().type; // تلفن همراه\nnew Bill({ billId: 7748317800105, paymentId: 1770160 }).getResult().type; // unknown\n\n// Check Bill id validation\nnew Bill({ billId: 7748317800142, paymentId: 1770160 }).getResult().isValidBillId; // true\nnew Bill({ billId: 2234322344613, paymentId: 1070189 }).getResult().isValidBillId; // false\n\n// Check Bill's payment id validation\nnew Bill({ billId: 7748317800142, paymentId: 1770160 }).getResult().isValidBillPayment; // true\nnew Bill({ billId: 9174639504124, paymentId: 12908197 }).getResult().isValidBillPayment; // false\n\n// Check Bill id and payment id relations which is valid or not\nnew Bill({ billId: 7748317800142, paymentId: 1770160 }).getResult().isValid; // true\nnew Bill({ billId: 2234322344613, paymentId: 1070189 }).getResult().isValid; // false\n\n// Get barcode from billId and paymentId\nnew Bill({ billId: 7748317800142, paymentId: 1770160 }).getResult().barcode; // 77483178001420001770160\nnew Bill({ billId: 9174639504124, paymentId: 12908197 }).getResult().barcode; // 917463950412400012908197\n\n// Get bill bill id and payment id by bill's barcode\nnew Bill({ barcode: \"22343223446130001070189\" }).findByBarcode(); // { billId: 2234322344613 , paymentId: 1070189 }\n```\n\n### Iranian Sheba(IBAN)\n\n- Check validation\n\n```javascript\nimport { isShebaValid } from \"@persian-tools/persian-tools\";\n\nisShebaValid(\"IR820540102680020817909002\"); // true\nisShebaValid(\"IR01234567890123456789\"); // false\n```\n\n- Recognize bank information\n\n```javascript\nimport { getShebaInfo } from \"@persian-tools/persian-tools\";\n\ngetShebaInfo(\"IR820540102680020817909002\");\n/*\n Result: {\n    \"nickname\": \"parsian\",\n    \"name\": \"Parsian Bank\",\n    \"persianName\": \"بانک پارسیان\",\n    \"code\": \"054\",\n    \"accountNumberAvailable\": true,\n    \"accountNumber\": \"020817909002\",\n    \"formattedAccountNumber\": \"002-00817909-002\"\n  }\n*/\n```\n\n### Fix Persian zero-width non-joiner(Replace spaces by half-space)\n\n```javascript\nimport { halfSpace } from \"@persian-tools/persian-tools\";\n\nhalfSpace(\"نمی ‌خواهی درخت ها را ببینیم؟\"); // \"نمی‌خواهی درخت‌ها را ببینیم؟\"\n```\n\n### Get information(province, category, type) about vehicles plate\n\n| Properties | Description                     | Return type    |\n| ---------- | ------------------------------- | -------------- |\n| `info`     | provide info about plate        | PlateResultApi |\n| `isValid`  | checks if plate is valid or not | boolean        |\n\n**Usage**\n\n```js\nimport { getNumberPlateInfo } from \"@persian-tools/persian-tools\";\n\ngetNumberPlateInfo(\"12D45147\"); // passing string argument\n\n// or passing in object style\ngetNumberPlateInfo({\n\tnumber: \"1245147\",\n\tchar: \"الف\",\n});\n```\n\n- Getting info about plate\n\n```js\nimport { getNumberPlateInfo } from \"@persian-tools/persian-tools\";\n\ngetNumberPlateInfo(\"12D45147\").info;\n/*\n  {\n  \ttemplate: 12 D 451 ایران  47\n    province: مرکزی ,\n    type: Car,\n\tcategory: دیپلمات,   \n    details: {\n\tfirstTwoDigits: 12,\n\tplateCharacter: D,\n\tnextThreeDigits: 451,\n\tprovinceCode: 47\n    }\n  }\n*/\n\n// handle motorcyles plate\ngetNumberPlateInfo(12345678).info;\n/*\n  {\n    template: 123-45678,\n\tprovince: مرکز تهران,\n    type: Motorcyle,\n    category: null,\n    details: {\n    \tdigits: 45678\n\tprovinceCode:123\n    }\n  }\n*/\n```\n\nPlates that have farsi digits in them(like: الف، ب، ص) will be returned in this template\n\n```\n  ${first_two_digits}${plate_character}${next_three_digits}ایران${province_code}\n```\n\n- Checking if plate is valid\n\n```js\nimport { getNumberPlateInfo } from \"@persian-tools/persian-tools\";\n\ngetNumberPlateInfo(\"12D45147\").isValid;\n/*\n  true\n*/\n\ngetNumberPlateInfo(12345678).isValid;\n/*\n  true\n*/\n\ngetNumberPlateInfo(1234567).isValid;\n/*\n  will return false - plate character is not provided\n*/\n\ngetNumberPlateInfo(1204567).isValid;\n/*\n  will return false - plate can't have 0 in its digits (except last digit)\n*/\n```\n\n### Convert Jalaali date-time into a time ago\n\n**Usage**\n\n\u003e Suppose the current time is equal to `1400/03/17 18:00:00`\n\n```js\nimport { timeAgo } from \"@persian-tools/persian-tools\";\n\n// Previous\ntimeAgo(\"1400/03/17 17:55:00\"); // 5 دقیقه قبل\ntimeAgo(\"1400/02/17 18:00:00\"); // حدود 1 ماه  قبل\n\n// Next\ntimeAgo(\"1400/04/07 18:00:00\"); // حدود 3 هفته  بعد\ntimeAgo(\"1401/03/17 18:00:00\"); // حدود 1 سال  بعد\n```\n\n### Get the Remaining Time of the Date\n\n**Usage**\n\n\u003e Takes a date(it could be string, number or date) and calculate years,\n\u003e months, days, hours, minutes and seconds remained to that specific date.\n\n```js\nimport { remainingTime } from \"@persian-tools/persian-tools\";\n\nremainingTime(\"2023-05-14T13:35:59Z\").toString(); // ۱ سال و ۱ ماه و ۲ روز و ۳ ساعت و ۵ دقیقه و ۸ ثانیه\n\nconst { years, months, days, hours, minutes, seconds, isFinished } = remainingTime(\"2023-05-14T13:35:59Z\");\nyears; // 1\nminutes; // 5\nisFinished; // false\n\nremainingTime(\"2018-04-12T10:30:51Z\").isFinished; // true\n```\n\n### Validate and find information of phone number\n\n**Usage**\n\n- Finding information such as province, type and model of phone number\n\n```js\nimport { phoneNumberDetail } from \"@persian-tools/persian-tools\";\n\nphoneNumberDetail(\"9123456789\");\n/*\n  {\n    province: [\"البرز\", \"زنجان\", \"سمنان\", \"قزوین\", \"قم\", \"برخی از شهرستان های استان مرکزی\"],\n    base: \"تهران\",\n    operator: \"همراه اول\",\n    type: [\"permanent\"],\n  }\n*/\n\nphoneNumberDetail(\"09301234567\");\n/*\n  {\n    province: [],\n    base: \"کشوری\",\n    operator: \"ایرانسل\",\n    type: [\"permanent\", \"credit\"],\n  }\n*/\n\nphoneNumberDetail(\"09981000000\");\n/*\n  {\n    province: [],\n    base: \"کشوری\",\n    operator: \"شاتل موبایل\",\n    type: [\"credit\"],\n  }\n*/\n```\n\n- Validating phone number\n\n```js\nimport { isPhoneNumberValid } from \"@persian-tools/persian-tools\";\n\nisPhoneNumberValid(\"09122002580\"); // true\nisPhoneNumberValid(\"09192002580\"); // true\n\nisPhoneNumberValid(\"+989122002580\"); // true\nisPhoneNumberValid(\"09122002580\"); // true\nisPhoneNumberValid(\"989122002580\"); // true\nisPhoneNumberValid(\"00989122002580\"); // true\nisPhoneNumberValid(\"9122002580\"); // true\n\nisPhoneNumberValid(\"09812002580\"); // false\n```\n\n- Normalizing phone number\n\n```js\nimport { phoneNumberNormalizer } from \"@persian-tools/persian-tools\";\n\nphoneNumberNormalizer(\"+989122002580\", \"0\"); // 09122002580\nphoneNumberNormalizer(\"989122002580\", \"0\"); // 09122002580\nphoneNumberNormalizer(\"09122002580\", \"0\"); // 09122002580\nphoneNumberNormalizer(\"09122002580\", \"+98\"); // +989122002580\n```\n\n### Find capital city by province name\n\n**Usage**\n\n\u003e This function returns the Capital City name by its state name. if it can't find anything, it will throws an error.\n\n```js\nimport { findCapitalByProvince } from \"@persian-tools/persian-tools\";\n\nfindCapitalByProvince(\"خراسان رضوی\"); // مشهد\nfindCapitalByProvince(\"آذربایجان شرقی\"); // تبریز\n\n// this throw an error string 'no province found'\nfindCapitalByProvince(\"دبی\");\n```\n\n### Find province from coordinate\n\n**Usage**\n\n\u003e Find the province from a given coordinate point. If it cannot find anything, it will throw an error.\n\n```javascript\nimport { findProvinceFromCoordinate } from \"@persian-tools/persian-tools\";\n\n// Find province for a given coordinate point\nconst point = { latitude: 35.6892, longitude: 51.389 };\n\nconst province = findProvinceFromCoordinate(point);\n\nprovince.fa; // \"تهران\"\nprovince.en; // \"Tehran\"\n\n// shorthand syntax using destructuring\nconst { fa, en } = findProvinceFromCoordinate(point);\n```\n\n### Todo\n\n- [ ] Write Jalaali and Gregorian functions to convert Date together.\n\n## Contributing\n\nThank you for your interest in contributing! Please feel free to put up a PR for any issue or feature request.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE.md](https://github.com/ali-master/persian-tools/blob/master/LICENSE) file for details.\n\n## Who's using Persian tools?\n\n\u003ctable\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd align=\"center\"\u003e\n\t\t\t\u003ca href=\"https://pooleno.ir\"\u003e\n\t\t\t\t\u003cimg src=\"https://pooleno.ir/static/images/pooleno-logo.svg\" width=\"100px;\" alt=\"Pooleno Crypto Exchange\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003ePooleno Exchange\u003c/b\u003e\u003c/sub\u003e\n\t\t\t\u003c/a\u003e\n\t\t\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\n\t\t\t\u003ca href=\"https://pwa.bank-maskan.ir\"\u003e\n\t\t\t\t\u003cimg src=\"./images/showcases/bank-maskan.png\" width=\"100px;\" alt=\"Bank Maskan (PWA)\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eBank Maskan\u003c/b\u003e\u003c/sub\u003e\n\t\t\t\u003c/a\u003e\n\t\t\u003c/td\u003e\n\t\t\u003ctd align=\"center\"\u003e\n\t\t\t\u003ca href=\"https://mydong.ir\"\u003e\n\t\t\t\t\u003cimg src=\"./images/showcases/mydong.png\" width=\"100px;\" alt=\"MyDong\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eMyDong\u003c/b\u003e\u003c/sub\u003e\n\t\t\t\u003c/a\u003e\n\t\t\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\n\t\t\t\u003ca href=\"https://melkba.ir\"\u003e\n\t\t\t\t\u003cimg src=\"./images/showcases/melkba.png\" width=\"100px;\" alt=\"Melkba\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eMelkba\u003c/b\u003e\u003c/sub\u003e\n\t\t\t\u003c/a\u003e\n\t\t\u003c/td\u003e\n\t\u003c/tr\u003e\n\u003c/table\u003e\n\nIf you're curious to see what can be accomplished with Persian tools, check out these apps!\n\nIf you have a software you'd like to see added, please\n[open a pull request](https://help.github.com/articles/creating-a-pull-request/)!\nAll that's required is a name, link, and a PNG icon.\n\n## Contributors ✨\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://www.linkedin.com/in/alitorki/\"\u003e\u003cimg src=\"https://avatars1.githubusercontent.com/u/9049092?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eAli Torki\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#infra-ali-master\" title=\"Infrastructure (Hosting, Build-Tools, etc)\"\u003e🚇\u003c/a\u003e \u003ca href=\"https://github.com/persian-tools/persian-tools/commits?author=ali-master\" title=\"Tests\"\u003e⚠️\u003c/a\u003e \u003ca href=\"https://github.com/persian-tools/persian-tools/commits?author=ali-master\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/mssoheil\"\u003e\u003cimg src=\"https://avatars3.githubusercontent.com/u/16543635?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003emssoheil\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/persian-tools/persian-tools/commits?author=mssoheil\" title=\"Tests\"\u003e⚠️\u003c/a\u003e \u003ca href=\"https://github.com/persian-tools/persian-tools/commits?author=mssoheil\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/moh3n9595\"\u003e\u003cimg src=\"https://avatars1.githubusercontent.com/u/20948388?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eMohsen\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/persian-tools/persian-tools/commits?author=moh3n9595\" title=\"Tests\"\u003e⚠️\u003c/a\u003e \u003ca href=\"https://github.com/persian-tools/persian-tools/commits?author=moh3n9595\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"http://titles.ir\"\u003e\u003cimg src=\"https://avatars1.githubusercontent.com/u/1300289?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eHesam pourghazian\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/persian-tools/persian-tools/commits?author=Hesamp\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/amirqasemi74\"\u003e\u003cimg src=\"https://avatars3.githubusercontent.com/u/20992734?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eAmir Hossien Qasemi Moqaddam\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/persian-tools/persian-tools/commits?author=amirqasemi74\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/SeyyedKhandon\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/59599950?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eSeyyedKhandon\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/persian-tools/persian-tools/commits?author=SeyyedKhandon\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/masoudDaliriyan\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/25932831?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003emsdDaliriyan\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/persian-tools/persian-tools/commits?author=masoudDaliriyan\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/persian-tools/persian-tools/commits?author=masoudDaliriyan\" title=\"Tests\"\u003e⚠️\u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://mahdi-momeni.github.io/\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/32864532?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eMahdi\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/persian-tools/persian-tools/commits?author=mahdi-momeni\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/persian-tools/persian-tools/commits?author=mahdi-momeni\" title=\"Tests\"\u003e⚠️\u003c/a\u003e \u003ca href=\"https://github.com/persian-tools/persian-tools/commits?author=mahdi-momeni\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://dev.to/psparsa\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/57572461?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003ePS-PARSA\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/persian-tools/persian-tools/commits?author=psparsa\" title=\"Tests\"\u003e⚠️\u003c/a\u003e \u003ca href=\"https://github.com/persian-tools/persian-tools/commits?author=psparsa\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"#ideas-psparsa\" title=\"Ideas, Planning, \u0026 Feedback\"\u003e🤔\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"http://amirduzandeh.ir/\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/16349391?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eAmirhossein Douzandeh Zenoozi\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/persian-tools/persian-tools/commits?author=amirzenoozi\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/persian-tools/persian-tools/commits?author=amirzenoozi\" title=\"Tests\"\u003e⚠️\u003c/a\u003e \u003ca href=\"#ideas-amirzenoozi\" title=\"Ideas, Planning, \u0026 Feedback\"\u003e🤔\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/M0rteza-M\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/79398146?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eM0rteza-M\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/persian-tools/persian-tools/commits?author=M0rteza-M\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/persian-tools/persian-tools/commits?author=M0rteza-M\" title=\"Tests\"\u003e⚠️\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://www.mahdi.wtf/\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/36822136?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003emediv0\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/persian-tools/persian-tools/commits?author=mediv0\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/persian-tools/persian-tools/commits?author=mediv0\" title=\"Tests\"\u003e⚠️\u003c/a\u003e \u003ca href=\"#ideas-mediv0\" title=\"Ideas, Planning, \u0026 Feedback\"\u003e🤔\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://www.linkedin.com/in/poorshad/\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/43247296?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003ePoorshad Shaddel\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/persian-tools/persian-tools/commits?author=pshaddel\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/persian-tools/persian-tools/commits?author=pshaddel\" title=\"Tests\"\u003e⚠️\u003c/a\u003e \u003ca href=\"#ideas-pshaddel\" title=\"Ideas, Planning, \u0026 Feedback\"\u003e🤔\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"http://t.me/theMasix\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/22872117?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eSeyed Masih Sajadi\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/persian-tools/persian-tools/commits?author=theMasix\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/persian-tools/persian-tools/commits?author=theMasix\" title=\"Tests\"\u003e⚠️\u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://www.samasarin.com\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/30124243?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eMohammad Ghonchesefidi\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/persian-tools/persian-tools/commits?author=ghonchesefidi\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/persian-tools/persian-tools/commits?author=ghonchesefidi\" title=\"Tests\"\u003e⚠️\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://www.linkedin.com/in/realsaeedhassani/\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/20496196?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eSaeed Hasani Borzadaran\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/persian-tools/persian-tools/commits?author=realsaeedhassani\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/persian-tools/persian-tools/commits?author=realsaeedhassani\" title=\"Tests\"\u003e⚠️\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/mrunderline\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/23085360?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eAli Madihi\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/persian-tools/persian-tools/commits?author=mrunderline\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/Amir-Alipour\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/73488911?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eAmir\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/persian-tools/persian-tools/commits?author=Amir-Alipour\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"http://codewars.com/users/KavehKarami\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/48356643?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eKaveh Karami\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/persian-tools/persian-tools/commits?author=KavehKarami\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://damoon.pro\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/64106883?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eMehdi Shah abbasian\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/persian-tools/persian-tools/commits?author=shahabbasian\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-restore --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n\n# Supporters :open_hands:\n\n[![Stargazers repo roster for @persian-tools/persian-tools](https://reporoster.com/stars/persian-tools/persian-tools)](https://github.com/persian-tools/persian-tools/stargazers)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpersian-tools%2Fpersian-tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpersian-tools%2Fpersian-tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpersian-tools%2Fpersian-tools/lists"}