{"id":22093200,"url":"https://github.com/iadvize/javascript-i18n-library","last_synced_at":"2025-07-24T20:32:34.452Z","repository":{"id":57279556,"uuid":"43430359","full_name":"iadvize/javascript-i18n-library","owner":"iadvize","description":":fr::us::gb: This javascript library is used to format dates, numbers and currencies. It's compatible with Node and Browsers.","archived":false,"fork":false,"pushed_at":"2020-02-13T15:56:28.000Z","size":47,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":45,"default_branch":"master","last_synced_at":"2025-06-23T11:08:50.171Z","etag":null,"topics":["browser","currencies","dates","i18n","nodejs","numbers"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/iadvize.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null}},"created_at":"2015-09-30T11:58:34.000Z","updated_at":"2018-01-24T16:16:35.000Z","dependencies_parsed_at":"2022-09-18T11:22:06.185Z","dependency_job_id":null,"html_url":"https://github.com/iadvize/javascript-i18n-library","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/iadvize/javascript-i18n-library","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iadvize%2Fjavascript-i18n-library","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iadvize%2Fjavascript-i18n-library/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iadvize%2Fjavascript-i18n-library/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iadvize%2Fjavascript-i18n-library/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iadvize","download_url":"https://codeload.github.com/iadvize/javascript-i18n-library/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iadvize%2Fjavascript-i18n-library/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266808556,"owners_count":23987450,"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-07-24T02:00:09.469Z","response_time":99,"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":["browser","currencies","dates","i18n","nodejs","numbers"],"created_at":"2024-12-01T03:13:16.408Z","updated_at":"2025-07-24T20:32:34.110Z","avatar_url":"https://github.com/iadvize.png","language":"JavaScript","readme":"# javascript-i18n-library [![Circle CI](https://circleci.com/gh/iadvize/javascript-i18n-library.svg?style=svg)](https://circleci.com/gh/iadvize/javascript-i18n-library) [![npm version](https://badge.fury.io/js/javascript-i18n-library.svg)](https://badge.fury.io/js/javascript-i18n-library)\n\n\u003e This javascript library is used to format dates, numbers and currencies. It's compatible with Node and Browsers. It depends on Moment.JS and Numbro.JS\n\n## Examples\n\n```javascript\nvar dateToFormat = \"1990-11-26T23:21:00\"; // also accepts \"1990-11-26 23:21:00\" format\n\n// Dates\ni18nService.formatDate(dateToFormat);                            // 26/11/1990\ni18nService.formatDate(dateToFormat, i18nService.formats.SHORT); // 26/11/1990\ni18nService.formatDate(dateToFormat, i18nService.formats.MEDIUM); // 26/11/1990\ni18nService.formatDate(dateToFormat, i18nService.formats.LONG);  // 26 novembre 1990\n\n// Time\ni18nService.formatTime(dateToFormat);                            // 23:21\ni18nService.formatTime(dateToFormat, i18nService.formats.SHORT); // 23:21\ni18nService.formatTime(dateToFormat, i18nService.formats.MEDIUM); // 23:21:00\ni18nService.formatTime(dateToFormat, i18nService.formats.LONG);  // 23:21:00\n\n// DateTime\ni18nService.formatDateTime(dateToFormat);                            // 26/11/1990 23:21\ni18nService.formatDateTime(dateToFormat, i18nService.formats.SHORT); // 26/11/1990 23:21\ni18nService.formatDateTime(dateToFormat, i18nService.formats.MEDIUM); // 26/11/1990 23:21:00\ni18nService.formatDateTime(dateToFormat, i18nService.formats.LONG);  // 26 novembre 1990 23:21:00\n\n// TimeAgo\ni18nService.getTimeAgoFromTimestamp(1444227494000 /* millis */);\ni18nService.getTimeAgoFromDateTime(dateToFormat);\n\n// Format numbers\ni18nService.formatNumber(1000); // '1 000'\ni18nService.unformat('1 000'); // 1000\n\ni18nService.formatNumber(1000.1234); // '1 000,1234'\ni18nService.formatNumber(1000.1234, 0); // '1 000'\ni18nService.formatNumber(1000.1234, 1); // '1 000,1'\n\n// Format currency\ni18nService.formatCurrency(1000); // '1 000€'\ni18nService.formatCurrency(1000, '$'), // 1 000$\ni18nService.formatCurrency(1000.1234, 2, '$'), // 1 000,12$\ni18nService.unformat('1 000€'); // 1000\n\n// Format TimeAgo\ni18nService.formatTimeAgoFromDateTime(dateToFormat); // il y a quelques secondes\ni18nService.formatTimeAgoFromTimestamp(1444227494000 /* millis */); // il y a quelques secondes\n\n// Libs exposition\ni18nService.moment;\ni18nService.momentTimezone;\ni18nService.numbro;\n```\n\n## Install\n\n``` sh\nnpm install javascript-i18n-library --save\n```\n\n## Documentation\n\n### Configuration\n\nThe factory accept a config object to override default configuration.\n``` javascript\n{\n    referenceTimezone: 'Europe/Paris', // timezone used when no timezone is defined on the date to parse\n    timezone: 'Europe/Paris',          // timezone used to format the date\n    offset: 120,                       // override the targetTimezone, add this offset (in minutes) to the parsed date\n    locale: 'fr-FR',                   // locale used to format numbers, currencies and long date format\n    currency: 'EUR',                   // the currency to use when formatting currencies values\n    dateFormat: 'DMY',                 // generic format date (DMY, MDY or YMD)\n    isMeridianTime: false              // format the time in meridian time or 24 hours time\n}\n```\n\n### Configuration Node / Browserify\n\n``` javascript\nvar i18nServiceFactory = require('javascript-i18n-library');\nvar config = {\n    referenceTimezone: 'Europe/Paris',\n    timezone: 'Europe/Paris',\n    locale: 'fr-FR',\n    currency: 'EUR',\n    dateFormat: 'DMY',\n    isMeridianTime: false\n};\n\nvar i18nService = i18nServiceFactory(config);\n```\n\n### Configuration Browser\n\n``` javascript\nvar config = {\n    referenceTimezone: 'Europe/Paris',\n    timezone: 'Europe/Paris',\n    locale: 'fr-FR',\n    currency: 'EUR',\n    dateFormat: 'DMY',\n    isMeridianTime: false\n};\n\nvar i18nService = window.iadvize.i18nServiceFactory(config);\n```\n\n## Contribute\n\nLook at contribution guidelines here : [CONTRIBUTING.md](CONTRIBUTING.md)\n\n### Test\n\n```sh\nyarn test\n```\n\nTo automatically launch the tests when a file is changed :\n\n```sh\nyarn run-script watch-test\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiadvize%2Fjavascript-i18n-library","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiadvize%2Fjavascript-i18n-library","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiadvize%2Fjavascript-i18n-library/lists"}