Installations
npm install moment-hijri
Score
90.8
Supply Chain
98.7
Quality
82.6
Maintenance
100
Vulnerability
100
License
Releases
Contributors
Developer
Developer Guide
Module System
CommonJS
Min. Node Version
Typescript Support
No
Node Version
20.11.0
NPM Version
10.2.4
Statistics
209 Stars
62 Commits
84 Forks
5 Watching
5 Branches
13 Contributors
Updated on 26 Nov 2024
Bundle Size
309.60 kB
Minified
76.98 kB
Minified + Gzipped
Languages
JavaScript (100%)
Total Downloads
Cumulative downloads
Total Downloads
1,220,876
Last day
-2.1%
2,611
Compared to previous day
Last week
8.5%
14,213
Compared to previous week
Last month
11.1%
55,174
Compared to previous month
Last year
55.2%
472,719
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
1
moment-hijri
A Hijri (Based on Umm al-Qura calculations) calendar system plugin for moment.js.
About
Hijri is the Islamic lunar calendar used by Muslims to determine the proper days on which to observe the annual fasting, to attend Hajj, and to celebrate other Islamic holidays and festivals. More information about Hijri can be found at wikipedia.
This plugin adds Hijri calendar support to momentjs library.
Calendar conversion is based on the Umm al-Qura calculations.
Upgrading to 3.0.0 [31-Oct-2024 of 28-Rabii_2-1446]
Adjusted dates has been changed to match ummalqura:-
- 1446-05-29 (old 30)
- 1446-06-30 (old 29)
- 1485-09-29 (old 30)
- 1485-10-30 (old 29)
Upgrading to 2.0.0
Because of Using 'h' specifier might cause overlap with hour's specifier, the specifier has been changed from h
to i
as a prefix. For example in the previous version to get the four digit year,
hYYYY
will be used. In version 2.0 or above it should be replaced by iYYYY
.
Where to use it?
Like momentjs
, moment-hijri
works in browser and in Node.js.
Node.js
1npm install moment-hijri
1var moment = require('moment-hijri'); 2moment().format('iYYYY/iM/iD');
Browser
1<script src="moment.js"></script> 2<script src="moment-hijri.js"></script> 3<script> 4 moment().format('iYYYY/iM/iD'); 5</script>
Require.js
1require.config({ 2 paths: { 3 "moment": "path/to/moment", 4 "moment-hijri": "path/to/moment-hijri" 5 } 6}); 7define(["moment-hijri"], function (moment) { 8 moment().format('iYYYY/iM/iD'); 9});
API
This plugin tries to mimic momentjs
api. Basically, when formatting or parsing a string, add an i
to the format token such as 'iYYYY' or 'iM'. For example:
1m = moment('1410/8/28', 'iYYYY/iM/iD'); // Parse a Hijri date. 2m.format('iYYYY/iM/iD [is] YYYY/M/D'); // 1410/8/28 is 1990/3/25 3 4m.iYear(); // 1410 5m.iMonth(); // 7 6m.iDate(); // 28 7m.iDayOfYear(); // 236 8m.iWeek(); // 35 9m.iWeekYear(); // 1410 10 11m.add(1, 'iYear'); 12m.add(2, 'iMonth'); 13m.add(1, 'idate'); 14m.format('iYYYY/iM/iD'); // 1411/10/29 15 16m.iMonth(11); 17m.startOf('iMonth'); 18m.format('iYYYY/iM/iD'); // 1411/12/1 19 20m.iYear(1392); 21m.startOf('iYear'); 22m.format('iYYYY/iM/iD'); // 1420/1/1 23 24moment('1436/1/30', 'iYYYY/iMM/iDD').isValid(); // false (This month is only 29 days). 25moment('1436/2/30', 'iYYYY/iMM/iDD').isValid(); // true (This month is 30 days). 26 27moment('1436/2/6 16:40', 'iYYYY/iM/iD HH:mm').format('YYYY-M-D HH:mm:ss'); // 2014-11-28 16:40:00 28 29moment('2014-11-28 16:40:00', 'YYYY-M-D HH:mm:ss').endOf('iMonth').format('iYYYY/iM/iD HH:mm:ss'); // 1436/2/30 23:59:59 30 31// Complex parse: 32moment('1990 5 25', 'YYYY iM D').format('YYYY/MM/DD'); // 1990/03/25
To use the Arabic locale:
- Load moment-with-locales.
- Set the global or local locale to
ar-SA
see here. - use it normally :+1:
Here is example:
1 <!-- 1- Load the moment-with-locales --> 2 <script src="http://momentjs.com/downloads/moment-with-locales.min.js"></script> 3 <script src="https://raw.githubusercontent.com/xsoh/moment-hijri/master/moment-hijri.js"></script> 4 5 <script> 6 moment.locale('ar-SA');// 2- Set the global locale to `ar-SA` 7 m = moment(); 8 m.format('iYYYY/iM/iDهـ الموافق YYYY/M/Dم'); //3- use it normally 9 //١٤٣٧/٨/١٧هـ الموافق ٢٠١٦/٥/٢٤م 10 </script>
Acknowledgements
This project was built from the great work done by @behrang whose behind moment-jalaali project.
License
MIT
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
1 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
Reason
3 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 2
Reason
Found 6/24 approved changesets -- score normalized to 2
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/npm-grunt.yml:1
- Info: no jobLevel write permissions found
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-grunt.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/xsoh/moment-hijri/npm-grunt.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-grunt.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/xsoh/moment-hijri/npm-grunt.yml/master?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/npm-grunt.yml:27
- Info: 0 out of 2 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 npmCommand dependencies pinned
Reason
no effort to earn an OpenSSF best practices badge detected
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
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 19 are checked with a SAST tool
Score
3.7
/10
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to moment-hijri
@types/moment-hijri
TypeScript definitions for moment-hijri
ngx-angular-material-hijri-adapter
This library is an Angular material date adapter for Hijri Calendar Dates and Dates/Time depending on moment-hijri plugin and @angular/material.
@date-io/hijri
Abstraction over common javascript date management libraries
moment-hijri-fixed
A Hijri calendar (Based on Umm al-Qura calculations) plugin for moment.js. (fixed bug related to moment hijri)