mirror of
https://github.com/acamarata/temporal-hijri.git
synced 2026-07-02 11:50:42 +00:00
Compare commits
10 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e7fe51d7b3 | ||
|
|
515c554763 | ||
|
|
1f201ac895 | ||
|
|
5bd50384f2 | ||
|
|
8e5b35c3a3 | ||
|
|
4dd246f27a | ||
|
|
70bd956179 | ||
|
|
40478b6f7b | ||
|
|
cae2726766 | ||
|
|
e6fd9d14df |
32 changed files with 244 additions and 3260 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,5 +1,6 @@
|
||||||
node_modules/
|
node_modules/
|
||||||
dist/
|
dist/
|
||||||
|
coverage/
|
||||||
*.tgz
|
*.tgz
|
||||||
*.log
|
*.log
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,12 @@ All notable changes to this project will be documented in this file.
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## [Unreleased]
|
## [1.0.3] - 2026-06-10
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Date handed to hijri-core is now built via `Date.UTC()` to match hijri-core's UTC-day
|
||||||
|
contract; fixes previous-day results on east-of-UTC hosts (e.g. UTC+5, UTC+8).
|
||||||
|
Requires hijri-core 1.0.3.
|
||||||
|
|
||||||
## [1.0.2] - 2026-05-30
|
## [1.0.2] - 2026-05-30
|
||||||
|
|
||||||
|
|
|
||||||
16
README.md
16
README.md
|
|
@ -56,12 +56,28 @@ Full reference in the [wiki](https://github.com/acamarata/temporal-hijri/wiki).
|
||||||
- [Architecture](https://github.com/acamarata/temporal-hijri/wiki/Architecture)
|
- [Architecture](https://github.com/acamarata/temporal-hijri/wiki/Architecture)
|
||||||
- [Examples](https://github.com/acamarata/temporal-hijri/wiki/examples/basic-usage)
|
- [Examples](https://github.com/acamarata/temporal-hijri/wiki/examples/basic-usage)
|
||||||
|
|
||||||
|
## Conversion behavior
|
||||||
|
|
||||||
|
Conversions between ISO and Hijri dates are pure calendar-date mappings: the same
|
||||||
|
ISO date always maps to the same Hijri date on every machine, regardless of the host's
|
||||||
|
timezone. `Temporal.PlainDate` carries no time-of-day information, and the underlying
|
||||||
|
hijri-core engine operates on UTC calendar days, so there is no timezone dependency.
|
||||||
|
|
||||||
|
Note: the Islamic calendar begins a new day at sunset, not midnight. This library
|
||||||
|
follows the civil-calendar convention (midnight boundary) used by most software. Sunset
|
||||||
|
day-start determination is out of scope.
|
||||||
|
|
||||||
## Related
|
## Related
|
||||||
|
|
||||||
- [hijri-core](https://github.com/acamarata/hijri-core): the underlying calendar engine
|
- [hijri-core](https://github.com/acamarata/hijri-core): the underlying calendar engine
|
||||||
- [luxon-hijri](https://github.com/acamarata/luxon-hijri): Hijri support for Luxon
|
- [luxon-hijri](https://github.com/acamarata/luxon-hijri): Hijri support for Luxon
|
||||||
- [pray-calc](https://github.com/acamarata/pray-calc): Islamic prayer times
|
- [pray-calc](https://github.com/acamarata/pray-calc): Islamic prayer times
|
||||||
|
|
||||||
|
## Telemetry
|
||||||
|
|
||||||
|
This package supports opt-in anonymous usage telemetry — off by default.
|
||||||
|
Enable: `ACAMARATA_TELEMETRY=1`. See [TELEMETRY.md](./TELEMETRY.md) for what is sent and how to disable.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
MIT. Copyright (c) 2026 Aric Camarata. See [LICENSE](LICENSE).
|
MIT. Copyright (c) 2026 Aric Camarata. See [LICENSE](LICENSE).
|
||||||
|
|
|
||||||
8
TELEMETRY.md
Normal file
8
TELEMETRY.md
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
# Telemetry Disclosure
|
||||||
|
|
||||||
|
This package supports opt-in anonymous usage telemetry via [`@acamarata/telemetry`](https://github.com/acamarata/telemetry).
|
||||||
|
|
||||||
|
Telemetry is **off by default**. No data is sent unless you set `ACAMARATA_TELEMETRY=1`.
|
||||||
|
|
||||||
|
Full disclosure (what is sent, where it goes, how to disable):
|
||||||
|
[github.com/acamarata/telemetry/blob/main/TELEMETRY.md](https://github.com/acamarata/telemetry/blob/main/TELEMETRY.md)
|
||||||
|
|
@ -1,224 +0,0 @@
|
||||||
body, html {
|
|
||||||
margin:0; padding: 0;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
body {
|
|
||||||
font-family: Helvetica Neue, Helvetica, Arial;
|
|
||||||
font-size: 14px;
|
|
||||||
color:#333;
|
|
||||||
}
|
|
||||||
.small { font-size: 12px; }
|
|
||||||
*, *:after, *:before {
|
|
||||||
-webkit-box-sizing:border-box;
|
|
||||||
-moz-box-sizing:border-box;
|
|
||||||
box-sizing:border-box;
|
|
||||||
}
|
|
||||||
h1 { font-size: 20px; margin: 0;}
|
|
||||||
h2 { font-size: 14px; }
|
|
||||||
pre {
|
|
||||||
font: 12px/1.4 Consolas, "Liberation Mono", Menlo, Courier, monospace;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
-moz-tab-size: 2;
|
|
||||||
-o-tab-size: 2;
|
|
||||||
tab-size: 2;
|
|
||||||
}
|
|
||||||
a { color:#0074D9; text-decoration:none; }
|
|
||||||
a:hover { text-decoration:underline; }
|
|
||||||
.strong { font-weight: bold; }
|
|
||||||
.space-top1 { padding: 10px 0 0 0; }
|
|
||||||
.pad2y { padding: 20px 0; }
|
|
||||||
.pad1y { padding: 10px 0; }
|
|
||||||
.pad2x { padding: 0 20px; }
|
|
||||||
.pad2 { padding: 20px; }
|
|
||||||
.pad1 { padding: 10px; }
|
|
||||||
.space-left2 { padding-left:55px; }
|
|
||||||
.space-right2 { padding-right:20px; }
|
|
||||||
.center { text-align:center; }
|
|
||||||
.clearfix { display:block; }
|
|
||||||
.clearfix:after {
|
|
||||||
content:'';
|
|
||||||
display:block;
|
|
||||||
height:0;
|
|
||||||
clear:both;
|
|
||||||
visibility:hidden;
|
|
||||||
}
|
|
||||||
.fl { float: left; }
|
|
||||||
@media only screen and (max-width:640px) {
|
|
||||||
.col3 { width:100%; max-width:100%; }
|
|
||||||
.hide-mobile { display:none!important; }
|
|
||||||
}
|
|
||||||
|
|
||||||
.quiet {
|
|
||||||
color: #7f7f7f;
|
|
||||||
color: rgba(0,0,0,0.5);
|
|
||||||
}
|
|
||||||
.quiet a { opacity: 0.7; }
|
|
||||||
|
|
||||||
.fraction {
|
|
||||||
font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace;
|
|
||||||
font-size: 10px;
|
|
||||||
color: #555;
|
|
||||||
background: #E8E8E8;
|
|
||||||
padding: 4px 5px;
|
|
||||||
border-radius: 3px;
|
|
||||||
vertical-align: middle;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.path a:link, div.path a:visited { color: #333; }
|
|
||||||
table.coverage {
|
|
||||||
border-collapse: collapse;
|
|
||||||
margin: 10px 0 0 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.coverage td {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
vertical-align: top;
|
|
||||||
}
|
|
||||||
table.coverage td.line-count {
|
|
||||||
text-align: right;
|
|
||||||
padding: 0 5px 0 20px;
|
|
||||||
}
|
|
||||||
table.coverage td.line-coverage {
|
|
||||||
text-align: right;
|
|
||||||
padding-right: 10px;
|
|
||||||
min-width:20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.coverage td span.cline-any {
|
|
||||||
display: inline-block;
|
|
||||||
padding: 0 5px;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
.missing-if-branch {
|
|
||||||
display: inline-block;
|
|
||||||
margin-right: 5px;
|
|
||||||
border-radius: 3px;
|
|
||||||
position: relative;
|
|
||||||
padding: 0 4px;
|
|
||||||
background: #333;
|
|
||||||
color: yellow;
|
|
||||||
}
|
|
||||||
|
|
||||||
.skip-if-branch {
|
|
||||||
display: none;
|
|
||||||
margin-right: 10px;
|
|
||||||
position: relative;
|
|
||||||
padding: 0 4px;
|
|
||||||
background: #ccc;
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
.missing-if-branch .typ, .skip-if-branch .typ {
|
|
||||||
color: inherit !important;
|
|
||||||
}
|
|
||||||
.coverage-summary {
|
|
||||||
border-collapse: collapse;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
.coverage-summary tr { border-bottom: 1px solid #bbb; }
|
|
||||||
.keyline-all { border: 1px solid #ddd; }
|
|
||||||
.coverage-summary td, .coverage-summary th { padding: 10px; }
|
|
||||||
.coverage-summary tbody { border: 1px solid #bbb; }
|
|
||||||
.coverage-summary td { border-right: 1px solid #bbb; }
|
|
||||||
.coverage-summary td:last-child { border-right: none; }
|
|
||||||
.coverage-summary th {
|
|
||||||
text-align: left;
|
|
||||||
font-weight: normal;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
.coverage-summary th.file { border-right: none !important; }
|
|
||||||
.coverage-summary th.pct { }
|
|
||||||
.coverage-summary th.pic,
|
|
||||||
.coverage-summary th.abs,
|
|
||||||
.coverage-summary td.pct,
|
|
||||||
.coverage-summary td.abs { text-align: right; }
|
|
||||||
.coverage-summary td.file { white-space: nowrap; }
|
|
||||||
.coverage-summary td.pic { min-width: 120px !important; }
|
|
||||||
.coverage-summary tfoot td { }
|
|
||||||
|
|
||||||
.coverage-summary .sorter {
|
|
||||||
height: 10px;
|
|
||||||
width: 7px;
|
|
||||||
display: inline-block;
|
|
||||||
margin-left: 0.5em;
|
|
||||||
background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent;
|
|
||||||
}
|
|
||||||
.coverage-summary .sorted .sorter {
|
|
||||||
background-position: 0 -20px;
|
|
||||||
}
|
|
||||||
.coverage-summary .sorted-desc .sorter {
|
|
||||||
background-position: 0 -10px;
|
|
||||||
}
|
|
||||||
.status-line { height: 10px; }
|
|
||||||
/* yellow */
|
|
||||||
.cbranch-no { background: yellow !important; color: #111; }
|
|
||||||
/* dark red */
|
|
||||||
.red.solid, .status-line.low, .low .cover-fill { background:#C21F39 }
|
|
||||||
.low .chart { border:1px solid #C21F39 }
|
|
||||||
.highlighted,
|
|
||||||
.highlighted .cstat-no, .highlighted .fstat-no, .highlighted .cbranch-no{
|
|
||||||
background: #C21F39 !important;
|
|
||||||
}
|
|
||||||
/* medium red */
|
|
||||||
.cstat-no, .fstat-no, .cbranch-no, .cbranch-no { background:#F6C6CE }
|
|
||||||
/* light red */
|
|
||||||
.low, .cline-no { background:#FCE1E5 }
|
|
||||||
/* light green */
|
|
||||||
.high, .cline-yes { background:rgb(230,245,208) }
|
|
||||||
/* medium green */
|
|
||||||
.cstat-yes { background:rgb(161,215,106) }
|
|
||||||
/* dark green */
|
|
||||||
.status-line.high, .high .cover-fill { background:rgb(77,146,33) }
|
|
||||||
.high .chart { border:1px solid rgb(77,146,33) }
|
|
||||||
/* dark yellow (gold) */
|
|
||||||
.status-line.medium, .medium .cover-fill { background: #f9cd0b; }
|
|
||||||
.medium .chart { border:1px solid #f9cd0b; }
|
|
||||||
/* light yellow */
|
|
||||||
.medium { background: #fff4c2; }
|
|
||||||
|
|
||||||
.cstat-skip { background: #ddd; color: #111; }
|
|
||||||
.fstat-skip { background: #ddd; color: #111 !important; }
|
|
||||||
.cbranch-skip { background: #ddd !important; color: #111; }
|
|
||||||
|
|
||||||
span.cline-neutral { background: #eaeaea; }
|
|
||||||
|
|
||||||
.coverage-summary td.empty {
|
|
||||||
opacity: .5;
|
|
||||||
padding-top: 4px;
|
|
||||||
padding-bottom: 4px;
|
|
||||||
line-height: 1;
|
|
||||||
color: #888;
|
|
||||||
}
|
|
||||||
|
|
||||||
.cover-fill, .cover-empty {
|
|
||||||
display:inline-block;
|
|
||||||
height: 12px;
|
|
||||||
}
|
|
||||||
.chart {
|
|
||||||
line-height: 0;
|
|
||||||
}
|
|
||||||
.cover-empty {
|
|
||||||
background: white;
|
|
||||||
}
|
|
||||||
.cover-full {
|
|
||||||
border-right: none !important;
|
|
||||||
}
|
|
||||||
pre.prettyprint {
|
|
||||||
border: none !important;
|
|
||||||
padding: 0 !important;
|
|
||||||
margin: 0 !important;
|
|
||||||
}
|
|
||||||
.com { color: #999 !important; }
|
|
||||||
.ignore-none { color: #999; font-weight: normal; }
|
|
||||||
|
|
||||||
.wrapper {
|
|
||||||
min-height: 100%;
|
|
||||||
height: auto !important;
|
|
||||||
height: 100%;
|
|
||||||
margin: 0 auto -48px;
|
|
||||||
}
|
|
||||||
.footer, .push {
|
|
||||||
height: 48px;
|
|
||||||
}
|
|
||||||
|
|
@ -1,87 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
var jumpToCode = (function init() {
|
|
||||||
// Classes of code we would like to highlight in the file view
|
|
||||||
var missingCoverageClasses = ['.cbranch-no', '.cstat-no', '.fstat-no'];
|
|
||||||
|
|
||||||
// Elements to highlight in the file listing view
|
|
||||||
var fileListingElements = ['td.pct.low'];
|
|
||||||
|
|
||||||
// We don't want to select elements that are direct descendants of another match
|
|
||||||
var notSelector = ':not(' + missingCoverageClasses.join('):not(') + ') > '; // becomes `:not(a):not(b) > `
|
|
||||||
|
|
||||||
// Selector that finds elements on the page to which we can jump
|
|
||||||
var selector =
|
|
||||||
fileListingElements.join(', ') +
|
|
||||||
', ' +
|
|
||||||
notSelector +
|
|
||||||
missingCoverageClasses.join(', ' + notSelector); // becomes `:not(a):not(b) > a, :not(a):not(b) > b`
|
|
||||||
|
|
||||||
// The NodeList of matching elements
|
|
||||||
var missingCoverageElements = document.querySelectorAll(selector);
|
|
||||||
|
|
||||||
var currentIndex;
|
|
||||||
|
|
||||||
function toggleClass(index) {
|
|
||||||
missingCoverageElements
|
|
||||||
.item(currentIndex)
|
|
||||||
.classList.remove('highlighted');
|
|
||||||
missingCoverageElements.item(index).classList.add('highlighted');
|
|
||||||
}
|
|
||||||
|
|
||||||
function makeCurrent(index) {
|
|
||||||
toggleClass(index);
|
|
||||||
currentIndex = index;
|
|
||||||
missingCoverageElements.item(index).scrollIntoView({
|
|
||||||
behavior: 'smooth',
|
|
||||||
block: 'center',
|
|
||||||
inline: 'center'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function goToPrevious() {
|
|
||||||
var nextIndex = 0;
|
|
||||||
if (typeof currentIndex !== 'number' || currentIndex === 0) {
|
|
||||||
nextIndex = missingCoverageElements.length - 1;
|
|
||||||
} else if (missingCoverageElements.length > 1) {
|
|
||||||
nextIndex = currentIndex - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
makeCurrent(nextIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
function goToNext() {
|
|
||||||
var nextIndex = 0;
|
|
||||||
|
|
||||||
if (
|
|
||||||
typeof currentIndex === 'number' &&
|
|
||||||
currentIndex < missingCoverageElements.length - 1
|
|
||||||
) {
|
|
||||||
nextIndex = currentIndex + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
makeCurrent(nextIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
return function jump(event) {
|
|
||||||
if (
|
|
||||||
document.getElementById('fileSearch') === document.activeElement &&
|
|
||||||
document.activeElement != null
|
|
||||||
) {
|
|
||||||
// if we're currently focused on the search input, we don't want to navigate
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (event.which) {
|
|
||||||
case 78: // n
|
|
||||||
case 74: // j
|
|
||||||
goToNext();
|
|
||||||
break;
|
|
||||||
case 66: // b
|
|
||||||
case 75: // k
|
|
||||||
case 80: // p
|
|
||||||
goToPrevious();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
})();
|
|
||||||
window.addEventListener('keydown', jumpToCode);
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 445 B |
|
|
@ -1,131 +0,0 @@
|
||||||
|
|
||||||
<!doctype html>
|
|
||||||
<html lang="en">
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<title>Code coverage report for All files</title>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<link rel="stylesheet" href="prettify.css" />
|
|
||||||
<link rel="stylesheet" href="base.css" />
|
|
||||||
<link rel="shortcut icon" type="image/x-icon" href="favicon.png" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
||||||
<style type='text/css'>
|
|
||||||
.coverage-summary .sorter {
|
|
||||||
background-image: url(sort-arrow-sprite.png);
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<div class='wrapper'>
|
|
||||||
<div class='pad1'>
|
|
||||||
<h1>All files</h1>
|
|
||||||
<div class='clearfix'>
|
|
||||||
|
|
||||||
<div class='fl pad1y space-right2'>
|
|
||||||
<span class="strong">92.9% </span>
|
|
||||||
<span class="quiet">Statements</span>
|
|
||||||
<span class='fraction'>393/423</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class='fl pad1y space-right2'>
|
|
||||||
<span class="strong">80.35% </span>
|
|
||||||
<span class="quiet">Branches</span>
|
|
||||||
<span class='fraction'>45/56</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class='fl pad1y space-right2'>
|
|
||||||
<span class="strong">89.28% </span>
|
|
||||||
<span class="quiet">Functions</span>
|
|
||||||
<span class='fraction'>25/28</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class='fl pad1y space-right2'>
|
|
||||||
<span class="strong">92.9% </span>
|
|
||||||
<span class="quiet">Lines</span>
|
|
||||||
<span class='fraction'>393/423</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<p class="quiet">
|
|
||||||
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
|
|
||||||
</p>
|
|
||||||
<template id="filterTemplate">
|
|
||||||
<div class="quiet">
|
|
||||||
Filter:
|
|
||||||
<input type="search" id="fileSearch">
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</div>
|
|
||||||
<div class='status-line high'></div>
|
|
||||||
<div class="pad1">
|
|
||||||
<table class="coverage-summary">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
|
|
||||||
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
|
|
||||||
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
|
|
||||||
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
|
|
||||||
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
|
|
||||||
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
|
|
||||||
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
|
|
||||||
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
|
|
||||||
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
|
|
||||||
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody><tr>
|
|
||||||
<td class="file high" data-value="src"><a href="src/index.html">src</a></td>
|
|
||||||
<td data-value="100" class="pic high">
|
|
||||||
<div class="chart"><div class="cover-fill cover-full" style="width: 100%"></div><div class="cover-empty" style="width: 0%"></div></div>
|
|
||||||
</td>
|
|
||||||
<td data-value="100" class="pct high">100%</td>
|
|
||||||
<td data-value="12" class="abs high">12/12</td>
|
|
||||||
<td data-value="100" class="pct high">100%</td>
|
|
||||||
<td data-value="0" class="abs high">0/0</td>
|
|
||||||
<td data-value="100" class="pct high">100%</td>
|
|
||||||
<td data-value="0" class="abs high">0/0</td>
|
|
||||||
<td data-value="100" class="pct high">100%</td>
|
|
||||||
<td data-value="12" class="abs high">12/12</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td class="file high" data-value="src/calendars"><a href="src/calendars/index.html">src/calendars</a></td>
|
|
||||||
<td data-value="92.7" class="pic high">
|
|
||||||
<div class="chart"><div class="cover-fill" style="width: 92%"></div><div class="cover-empty" style="width: 8%"></div></div>
|
|
||||||
</td>
|
|
||||||
<td data-value="92.7" class="pct high">92.7%</td>
|
|
||||||
<td data-value="411" class="abs high">381/411</td>
|
|
||||||
<td data-value="80.35" class="pct high">80.35%</td>
|
|
||||||
<td data-value="56" class="abs high">45/56</td>
|
|
||||||
<td data-value="89.28" class="pct high">89.28%</td>
|
|
||||||
<td data-value="28" class="abs high">25/28</td>
|
|
||||||
<td data-value="92.7" class="pct high">92.7%</td>
|
|
||||||
<td data-value="411" class="abs high">381/411</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
<div class='push'></div><!-- for sticky footer -->
|
|
||||||
</div><!-- /wrapper -->
|
|
||||||
<div class='footer quiet pad2 space-top1 center small'>
|
|
||||||
Code coverage generated by
|
|
||||||
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
||||||
at 2026-05-30T19:44:00.925Z
|
|
||||||
</div>
|
|
||||||
<script src="prettify.js"></script>
|
|
||||||
<script>
|
|
||||||
window.onload = function () {
|
|
||||||
prettyPrint();
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
<script src="sorter.js"></script>
|
|
||||||
<script src="block-navigation.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}
|
|
||||||
File diff suppressed because one or more lines are too long
Binary file not shown.
|
Before Width: | Height: | Size: 138 B |
|
|
@ -1,210 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
var addSorting = (function() {
|
|
||||||
'use strict';
|
|
||||||
var cols,
|
|
||||||
currentSort = {
|
|
||||||
index: 0,
|
|
||||||
desc: false
|
|
||||||
};
|
|
||||||
|
|
||||||
// returns the summary table element
|
|
||||||
function getTable() {
|
|
||||||
return document.querySelector('.coverage-summary');
|
|
||||||
}
|
|
||||||
// returns the thead element of the summary table
|
|
||||||
function getTableHeader() {
|
|
||||||
return getTable().querySelector('thead tr');
|
|
||||||
}
|
|
||||||
// returns the tbody element of the summary table
|
|
||||||
function getTableBody() {
|
|
||||||
return getTable().querySelector('tbody');
|
|
||||||
}
|
|
||||||
// returns the th element for nth column
|
|
||||||
function getNthColumn(n) {
|
|
||||||
return getTableHeader().querySelectorAll('th')[n];
|
|
||||||
}
|
|
||||||
|
|
||||||
function onFilterInput() {
|
|
||||||
const searchValue = document.getElementById('fileSearch').value;
|
|
||||||
const rows = document.getElementsByTagName('tbody')[0].children;
|
|
||||||
|
|
||||||
// Try to create a RegExp from the searchValue. If it fails (invalid regex),
|
|
||||||
// it will be treated as a plain text search
|
|
||||||
let searchRegex;
|
|
||||||
try {
|
|
||||||
searchRegex = new RegExp(searchValue, 'i'); // 'i' for case-insensitive
|
|
||||||
} catch (error) {
|
|
||||||
searchRegex = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let i = 0; i < rows.length; i++) {
|
|
||||||
const row = rows[i];
|
|
||||||
let isMatch = false;
|
|
||||||
|
|
||||||
if (searchRegex) {
|
|
||||||
// If a valid regex was created, use it for matching
|
|
||||||
isMatch = searchRegex.test(row.textContent);
|
|
||||||
} else {
|
|
||||||
// Otherwise, fall back to the original plain text search
|
|
||||||
isMatch = row.textContent
|
|
||||||
.toLowerCase()
|
|
||||||
.includes(searchValue.toLowerCase());
|
|
||||||
}
|
|
||||||
|
|
||||||
row.style.display = isMatch ? '' : 'none';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// loads the search box
|
|
||||||
function addSearchBox() {
|
|
||||||
var template = document.getElementById('filterTemplate');
|
|
||||||
var templateClone = template.content.cloneNode(true);
|
|
||||||
templateClone.getElementById('fileSearch').oninput = onFilterInput;
|
|
||||||
template.parentElement.appendChild(templateClone);
|
|
||||||
}
|
|
||||||
|
|
||||||
// loads all columns
|
|
||||||
function loadColumns() {
|
|
||||||
var colNodes = getTableHeader().querySelectorAll('th'),
|
|
||||||
colNode,
|
|
||||||
cols = [],
|
|
||||||
col,
|
|
||||||
i;
|
|
||||||
|
|
||||||
for (i = 0; i < colNodes.length; i += 1) {
|
|
||||||
colNode = colNodes[i];
|
|
||||||
col = {
|
|
||||||
key: colNode.getAttribute('data-col'),
|
|
||||||
sortable: !colNode.getAttribute('data-nosort'),
|
|
||||||
type: colNode.getAttribute('data-type') || 'string'
|
|
||||||
};
|
|
||||||
cols.push(col);
|
|
||||||
if (col.sortable) {
|
|
||||||
col.defaultDescSort = col.type === 'number';
|
|
||||||
colNode.innerHTML =
|
|
||||||
colNode.innerHTML + '<span class="sorter"></span>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return cols;
|
|
||||||
}
|
|
||||||
// attaches a data attribute to every tr element with an object
|
|
||||||
// of data values keyed by column name
|
|
||||||
function loadRowData(tableRow) {
|
|
||||||
var tableCols = tableRow.querySelectorAll('td'),
|
|
||||||
colNode,
|
|
||||||
col,
|
|
||||||
data = {},
|
|
||||||
i,
|
|
||||||
val;
|
|
||||||
for (i = 0; i < tableCols.length; i += 1) {
|
|
||||||
colNode = tableCols[i];
|
|
||||||
col = cols[i];
|
|
||||||
val = colNode.getAttribute('data-value');
|
|
||||||
if (col.type === 'number') {
|
|
||||||
val = Number(val);
|
|
||||||
}
|
|
||||||
data[col.key] = val;
|
|
||||||
}
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
// loads all row data
|
|
||||||
function loadData() {
|
|
||||||
var rows = getTableBody().querySelectorAll('tr'),
|
|
||||||
i;
|
|
||||||
|
|
||||||
for (i = 0; i < rows.length; i += 1) {
|
|
||||||
rows[i].data = loadRowData(rows[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// sorts the table using the data for the ith column
|
|
||||||
function sortByIndex(index, desc) {
|
|
||||||
var key = cols[index].key,
|
|
||||||
sorter = function(a, b) {
|
|
||||||
a = a.data[key];
|
|
||||||
b = b.data[key];
|
|
||||||
return a < b ? -1 : a > b ? 1 : 0;
|
|
||||||
},
|
|
||||||
finalSorter = sorter,
|
|
||||||
tableBody = document.querySelector('.coverage-summary tbody'),
|
|
||||||
rowNodes = tableBody.querySelectorAll('tr'),
|
|
||||||
rows = [],
|
|
||||||
i;
|
|
||||||
|
|
||||||
if (desc) {
|
|
||||||
finalSorter = function(a, b) {
|
|
||||||
return -1 * sorter(a, b);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < rowNodes.length; i += 1) {
|
|
||||||
rows.push(rowNodes[i]);
|
|
||||||
tableBody.removeChild(rowNodes[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
rows.sort(finalSorter);
|
|
||||||
|
|
||||||
for (i = 0; i < rows.length; i += 1) {
|
|
||||||
tableBody.appendChild(rows[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// removes sort indicators for current column being sorted
|
|
||||||
function removeSortIndicators() {
|
|
||||||
var col = getNthColumn(currentSort.index),
|
|
||||||
cls = col.className;
|
|
||||||
|
|
||||||
cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, '');
|
|
||||||
col.className = cls;
|
|
||||||
}
|
|
||||||
// adds sort indicators for current column being sorted
|
|
||||||
function addSortIndicators() {
|
|
||||||
getNthColumn(currentSort.index).className += currentSort.desc
|
|
||||||
? ' sorted-desc'
|
|
||||||
: ' sorted';
|
|
||||||
}
|
|
||||||
// adds event listeners for all sorter widgets
|
|
||||||
function enableUI() {
|
|
||||||
var i,
|
|
||||||
el,
|
|
||||||
ithSorter = function ithSorter(i) {
|
|
||||||
var col = cols[i];
|
|
||||||
|
|
||||||
return function() {
|
|
||||||
var desc = col.defaultDescSort;
|
|
||||||
|
|
||||||
if (currentSort.index === i) {
|
|
||||||
desc = !currentSort.desc;
|
|
||||||
}
|
|
||||||
sortByIndex(i, desc);
|
|
||||||
removeSortIndicators();
|
|
||||||
currentSort.index = i;
|
|
||||||
currentSort.desc = desc;
|
|
||||||
addSortIndicators();
|
|
||||||
};
|
|
||||||
};
|
|
||||||
for (i = 0; i < cols.length; i += 1) {
|
|
||||||
if (cols[i].sortable) {
|
|
||||||
// add the click event handler on the th so users
|
|
||||||
// dont have to click on those tiny arrows
|
|
||||||
el = getNthColumn(i).querySelector('.sorter').parentElement;
|
|
||||||
if (el.addEventListener) {
|
|
||||||
el.addEventListener('click', ithSorter(i));
|
|
||||||
} else {
|
|
||||||
el.attachEvent('onclick', ithSorter(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// adds sorting functionality to the UI
|
|
||||||
return function() {
|
|
||||||
if (!getTable()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
cols = loadColumns();
|
|
||||||
loadData();
|
|
||||||
addSearchBox();
|
|
||||||
addSortIndicators();
|
|
||||||
enableUI();
|
|
||||||
};
|
|
||||||
})();
|
|
||||||
|
|
||||||
window.addEventListener('load', addSorting);
|
|
||||||
|
|
@ -1,151 +0,0 @@
|
||||||
|
|
||||||
<!doctype html>
|
|
||||||
<html lang="en">
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<title>Code coverage report for src/calendars/FcnaCalendar.ts</title>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<link rel="stylesheet" href="../../prettify.css" />
|
|
||||||
<link rel="stylesheet" href="../../base.css" />
|
|
||||||
<link rel="shortcut icon" type="image/x-icon" href="../../favicon.png" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
||||||
<style type='text/css'>
|
|
||||||
.coverage-summary .sorter {
|
|
||||||
background-image: url(../../sort-arrow-sprite.png);
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<div class='wrapper'>
|
|
||||||
<div class='pad1'>
|
|
||||||
<h1><a href="../../index.html">All files</a> / <a href="index.html">src/calendars</a> FcnaCalendar.ts</h1>
|
|
||||||
<div class='clearfix'>
|
|
||||||
|
|
||||||
<div class='fl pad1y space-right2'>
|
|
||||||
<span class="strong">100% </span>
|
|
||||||
<span class="quiet">Statements</span>
|
|
||||||
<span class='fraction'>22/22</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class='fl pad1y space-right2'>
|
|
||||||
<span class="strong">100% </span>
|
|
||||||
<span class="quiet">Branches</span>
|
|
||||||
<span class='fraction'>1/1</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class='fl pad1y space-right2'>
|
|
||||||
<span class="strong">100% </span>
|
|
||||||
<span class="quiet">Functions</span>
|
|
||||||
<span class='fraction'>1/1</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class='fl pad1y space-right2'>
|
|
||||||
<span class="strong">100% </span>
|
|
||||||
<span class="quiet">Lines</span>
|
|
||||||
<span class='fraction'>22/22</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<p class="quiet">
|
|
||||||
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
|
|
||||||
</p>
|
|
||||||
<template id="filterTemplate">
|
|
||||||
<div class="quiet">
|
|
||||||
Filter:
|
|
||||||
<input type="search" id="fileSearch">
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</div>
|
|
||||||
<div class='status-line high'></div>
|
|
||||||
<pre><table class="coverage">
|
|
||||||
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
|
|
||||||
<a name='L2'></a><a href='#L2'>2</a>
|
|
||||||
<a name='L3'></a><a href='#L3'>3</a>
|
|
||||||
<a name='L4'></a><a href='#L4'>4</a>
|
|
||||||
<a name='L5'></a><a href='#L5'>5</a>
|
|
||||||
<a name='L6'></a><a href='#L6'>6</a>
|
|
||||||
<a name='L7'></a><a href='#L7'>7</a>
|
|
||||||
<a name='L8'></a><a href='#L8'>8</a>
|
|
||||||
<a name='L9'></a><a href='#L9'>9</a>
|
|
||||||
<a name='L10'></a><a href='#L10'>10</a>
|
|
||||||
<a name='L11'></a><a href='#L11'>11</a>
|
|
||||||
<a name='L12'></a><a href='#L12'>12</a>
|
|
||||||
<a name='L13'></a><a href='#L13'>13</a>
|
|
||||||
<a name='L14'></a><a href='#L14'>14</a>
|
|
||||||
<a name='L15'></a><a href='#L15'>15</a>
|
|
||||||
<a name='L16'></a><a href='#L16'>16</a>
|
|
||||||
<a name='L17'></a><a href='#L17'>17</a>
|
|
||||||
<a name='L18'></a><a href='#L18'>18</a>
|
|
||||||
<a name='L19'></a><a href='#L19'>19</a>
|
|
||||||
<a name='L20'></a><a href='#L20'>20</a>
|
|
||||||
<a name='L21'></a><a href='#L21'>21</a>
|
|
||||||
<a name='L22'></a><a href='#L22'>22</a>
|
|
||||||
<a name='L23'></a><a href='#L23'>23</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">2x</span>
|
|
||||||
<span class="cline-any cline-yes">2x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import { getCalendar } from 'hijri-core';
|
|
||||||
import { HijriCalendar } from './HijriCalendar';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Temporal calendar implementation for the FCNA/ISNA calendar.
|
|
||||||
*
|
|
||||||
* The Fiqh Council of North America (FCNA) calendar, also used by the Islamic
|
|
||||||
* Society of North America (ISNA), determines month starts through astronomical
|
|
||||||
* calculation: a new month begins the day after the conjunction (new moon) if
|
|
||||||
* that conjunction occurs before 12:00 noon UTC, or two days after if at or
|
|
||||||
* after noon. This criterion enables global date-setting without local moon
|
|
||||||
* sighting, making it popular for diaspora Muslim communities in North America
|
|
||||||
* and Europe.
|
|
||||||
*
|
|
||||||
* Calendar engine: hijri-core FCNA (Meeus Chapter 49 calculations).
|
|
||||||
* Calendar ID: "hijri-fcna"
|
|
||||||
*/
|
|
||||||
export class FcnaCalendar extends HijriCalendar {
|
|
||||||
constructor() {
|
|
||||||
super(getCalendar('fcna'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</pre></td></tr></table></pre>
|
|
||||||
|
|
||||||
<div class='push'></div><!-- for sticky footer -->
|
|
||||||
</div><!-- /wrapper -->
|
|
||||||
<div class='footer quiet pad2 space-top1 center small'>
|
|
||||||
Code coverage generated by
|
|
||||||
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
||||||
at 2026-05-30T19:44:00.925Z
|
|
||||||
</div>
|
|
||||||
<script src="../../prettify.js"></script>
|
|
||||||
<script>
|
|
||||||
window.onload = function () {
|
|
||||||
prettyPrint();
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
<script src="../../sorter.js"></script>
|
|
||||||
<script src="../../block-navigation.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,145 +0,0 @@
|
||||||
|
|
||||||
<!doctype html>
|
|
||||||
<html lang="en">
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<title>Code coverage report for src/calendars/UaqCalendar.ts</title>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<link rel="stylesheet" href="../../prettify.css" />
|
|
||||||
<link rel="stylesheet" href="../../base.css" />
|
|
||||||
<link rel="shortcut icon" type="image/x-icon" href="../../favicon.png" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
||||||
<style type='text/css'>
|
|
||||||
.coverage-summary .sorter {
|
|
||||||
background-image: url(../../sort-arrow-sprite.png);
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<div class='wrapper'>
|
|
||||||
<div class='pad1'>
|
|
||||||
<h1><a href="../../index.html">All files</a> / <a href="index.html">src/calendars</a> UaqCalendar.ts</h1>
|
|
||||||
<div class='clearfix'>
|
|
||||||
|
|
||||||
<div class='fl pad1y space-right2'>
|
|
||||||
<span class="strong">100% </span>
|
|
||||||
<span class="quiet">Statements</span>
|
|
||||||
<span class='fraction'>20/20</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class='fl pad1y space-right2'>
|
|
||||||
<span class="strong">100% </span>
|
|
||||||
<span class="quiet">Branches</span>
|
|
||||||
<span class='fraction'>1/1</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class='fl pad1y space-right2'>
|
|
||||||
<span class="strong">100% </span>
|
|
||||||
<span class="quiet">Functions</span>
|
|
||||||
<span class='fraction'>1/1</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class='fl pad1y space-right2'>
|
|
||||||
<span class="strong">100% </span>
|
|
||||||
<span class="quiet">Lines</span>
|
|
||||||
<span class='fraction'>20/20</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<p class="quiet">
|
|
||||||
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
|
|
||||||
</p>
|
|
||||||
<template id="filterTemplate">
|
|
||||||
<div class="quiet">
|
|
||||||
Filter:
|
|
||||||
<input type="search" id="fileSearch">
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</div>
|
|
||||||
<div class='status-line high'></div>
|
|
||||||
<pre><table class="coverage">
|
|
||||||
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
|
|
||||||
<a name='L2'></a><a href='#L2'>2</a>
|
|
||||||
<a name='L3'></a><a href='#L3'>3</a>
|
|
||||||
<a name='L4'></a><a href='#L4'>4</a>
|
|
||||||
<a name='L5'></a><a href='#L5'>5</a>
|
|
||||||
<a name='L6'></a><a href='#L6'>6</a>
|
|
||||||
<a name='L7'></a><a href='#L7'>7</a>
|
|
||||||
<a name='L8'></a><a href='#L8'>8</a>
|
|
||||||
<a name='L9'></a><a href='#L9'>9</a>
|
|
||||||
<a name='L10'></a><a href='#L10'>10</a>
|
|
||||||
<a name='L11'></a><a href='#L11'>11</a>
|
|
||||||
<a name='L12'></a><a href='#L12'>12</a>
|
|
||||||
<a name='L13'></a><a href='#L13'>13</a>
|
|
||||||
<a name='L14'></a><a href='#L14'>14</a>
|
|
||||||
<a name='L15'></a><a href='#L15'>15</a>
|
|
||||||
<a name='L16'></a><a href='#L16'>16</a>
|
|
||||||
<a name='L17'></a><a href='#L17'>17</a>
|
|
||||||
<a name='L18'></a><a href='#L18'>18</a>
|
|
||||||
<a name='L19'></a><a href='#L19'>19</a>
|
|
||||||
<a name='L20'></a><a href='#L20'>20</a>
|
|
||||||
<a name='L21'></a><a href='#L21'>21</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">2x</span>
|
|
||||||
<span class="cline-any cline-yes">2x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import { getCalendar } from 'hijri-core';
|
|
||||||
import { HijriCalendar } from './HijriCalendar';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Temporal calendar implementation for the Umm al-Qura calendar.
|
|
||||||
*
|
|
||||||
* Umm al-Qura is the official calendar of Saudi Arabia, maintained by the
|
|
||||||
* King Abdulaziz City for Science and Technology (KACST). It is the most
|
|
||||||
* widely used Hijri calendar standard for civil and religious purposes across
|
|
||||||
* the Muslim world. Month boundaries are determined by pre-calculated tables
|
|
||||||
* rather than real-time moon sighting.
|
|
||||||
*
|
|
||||||
* Calendar engine: hijri-core UAQ (table-driven, covers 1318-1500 AH).
|
|
||||||
* Calendar ID: "hijri-uaq"
|
|
||||||
*/
|
|
||||||
export class UaqCalendar extends HijriCalendar {
|
|
||||||
constructor() {
|
|
||||||
super(getCalendar('uaq'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</pre></td></tr></table></pre>
|
|
||||||
|
|
||||||
<div class='push'></div><!-- for sticky footer -->
|
|
||||||
</div><!-- /wrapper -->
|
|
||||||
<div class='footer quiet pad2 space-top1 center small'>
|
|
||||||
Code coverage generated by
|
|
||||||
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
||||||
at 2026-05-30T19:44:00.925Z
|
|
||||||
</div>
|
|
||||||
<script src="../../prettify.js"></script>
|
|
||||||
<script>
|
|
||||||
window.onload = function () {
|
|
||||||
prettyPrint();
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
<script src="../../sorter.js"></script>
|
|
||||||
<script src="../../block-navigation.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
||||||
|
|
@ -1,146 +0,0 @@
|
||||||
|
|
||||||
<!doctype html>
|
|
||||||
<html lang="en">
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<title>Code coverage report for src/calendars</title>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<link rel="stylesheet" href="../../prettify.css" />
|
|
||||||
<link rel="stylesheet" href="../../base.css" />
|
|
||||||
<link rel="shortcut icon" type="image/x-icon" href="../../favicon.png" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
||||||
<style type='text/css'>
|
|
||||||
.coverage-summary .sorter {
|
|
||||||
background-image: url(../../sort-arrow-sprite.png);
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<div class='wrapper'>
|
|
||||||
<div class='pad1'>
|
|
||||||
<h1><a href="../../index.html">All files</a> src/calendars</h1>
|
|
||||||
<div class='clearfix'>
|
|
||||||
|
|
||||||
<div class='fl pad1y space-right2'>
|
|
||||||
<span class="strong">92.7% </span>
|
|
||||||
<span class="quiet">Statements</span>
|
|
||||||
<span class='fraction'>381/411</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class='fl pad1y space-right2'>
|
|
||||||
<span class="strong">80.35% </span>
|
|
||||||
<span class="quiet">Branches</span>
|
|
||||||
<span class='fraction'>45/56</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class='fl pad1y space-right2'>
|
|
||||||
<span class="strong">89.28% </span>
|
|
||||||
<span class="quiet">Functions</span>
|
|
||||||
<span class='fraction'>25/28</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class='fl pad1y space-right2'>
|
|
||||||
<span class="strong">92.7% </span>
|
|
||||||
<span class="quiet">Lines</span>
|
|
||||||
<span class='fraction'>381/411</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<p class="quiet">
|
|
||||||
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
|
|
||||||
</p>
|
|
||||||
<template id="filterTemplate">
|
|
||||||
<div class="quiet">
|
|
||||||
Filter:
|
|
||||||
<input type="search" id="fileSearch">
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</div>
|
|
||||||
<div class='status-line high'></div>
|
|
||||||
<div class="pad1">
|
|
||||||
<table class="coverage-summary">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
|
|
||||||
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
|
|
||||||
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
|
|
||||||
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
|
|
||||||
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
|
|
||||||
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
|
|
||||||
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
|
|
||||||
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
|
|
||||||
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
|
|
||||||
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody><tr>
|
|
||||||
<td class="file high" data-value="FcnaCalendar.ts"><a href="FcnaCalendar.ts.html">FcnaCalendar.ts</a></td>
|
|
||||||
<td data-value="100" class="pic high">
|
|
||||||
<div class="chart"><div class="cover-fill cover-full" style="width: 100%"></div><div class="cover-empty" style="width: 0%"></div></div>
|
|
||||||
</td>
|
|
||||||
<td data-value="100" class="pct high">100%</td>
|
|
||||||
<td data-value="22" class="abs high">22/22</td>
|
|
||||||
<td data-value="100" class="pct high">100%</td>
|
|
||||||
<td data-value="1" class="abs high">1/1</td>
|
|
||||||
<td data-value="100" class="pct high">100%</td>
|
|
||||||
<td data-value="1" class="abs high">1/1</td>
|
|
||||||
<td data-value="100" class="pct high">100%</td>
|
|
||||||
<td data-value="22" class="abs high">22/22</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td class="file high" data-value="HijriCalendar.ts"><a href="HijriCalendar.ts.html">HijriCalendar.ts</a></td>
|
|
||||||
<td data-value="91.86" class="pic high">
|
|
||||||
<div class="chart"><div class="cover-fill" style="width: 91%"></div><div class="cover-empty" style="width: 9%"></div></div>
|
|
||||||
</td>
|
|
||||||
<td data-value="91.86" class="pct high">91.86%</td>
|
|
||||||
<td data-value="369" class="abs high">339/369</td>
|
|
||||||
<td data-value="79.62" class="pct medium">79.62%</td>
|
|
||||||
<td data-value="54" class="abs medium">43/54</td>
|
|
||||||
<td data-value="88.46" class="pct high">88.46%</td>
|
|
||||||
<td data-value="26" class="abs high">23/26</td>
|
|
||||||
<td data-value="91.86" class="pct high">91.86%</td>
|
|
||||||
<td data-value="369" class="abs high">339/369</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td class="file high" data-value="UaqCalendar.ts"><a href="UaqCalendar.ts.html">UaqCalendar.ts</a></td>
|
|
||||||
<td data-value="100" class="pic high">
|
|
||||||
<div class="chart"><div class="cover-fill cover-full" style="width: 100%"></div><div class="cover-empty" style="width: 0%"></div></div>
|
|
||||||
</td>
|
|
||||||
<td data-value="100" class="pct high">100%</td>
|
|
||||||
<td data-value="20" class="abs high">20/20</td>
|
|
||||||
<td data-value="100" class="pct high">100%</td>
|
|
||||||
<td data-value="1" class="abs high">1/1</td>
|
|
||||||
<td data-value="100" class="pct high">100%</td>
|
|
||||||
<td data-value="1" class="abs high">1/1</td>
|
|
||||||
<td data-value="100" class="pct high">100%</td>
|
|
||||||
<td data-value="20" class="abs high">20/20</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
<div class='push'></div><!-- for sticky footer -->
|
|
||||||
</div><!-- /wrapper -->
|
|
||||||
<div class='footer quiet pad2 space-top1 center small'>
|
|
||||||
Code coverage generated by
|
|
||||||
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
||||||
at 2026-05-30T19:44:00.925Z
|
|
||||||
</div>
|
|
||||||
<script src="../../prettify.js"></script>
|
|
||||||
<script>
|
|
||||||
window.onload = function () {
|
|
||||||
prettyPrint();
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
<script src="../../sorter.js"></script>
|
|
||||||
<script src="../../block-navigation.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
||||||
|
|
@ -1,116 +0,0 @@
|
||||||
|
|
||||||
<!doctype html>
|
|
||||||
<html lang="en">
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<title>Code coverage report for src</title>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<link rel="stylesheet" href="../prettify.css" />
|
|
||||||
<link rel="stylesheet" href="../base.css" />
|
|
||||||
<link rel="shortcut icon" type="image/x-icon" href="../favicon.png" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
||||||
<style type='text/css'>
|
|
||||||
.coverage-summary .sorter {
|
|
||||||
background-image: url(../sort-arrow-sprite.png);
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<div class='wrapper'>
|
|
||||||
<div class='pad1'>
|
|
||||||
<h1><a href="../index.html">All files</a> src</h1>
|
|
||||||
<div class='clearfix'>
|
|
||||||
|
|
||||||
<div class='fl pad1y space-right2'>
|
|
||||||
<span class="strong">100% </span>
|
|
||||||
<span class="quiet">Statements</span>
|
|
||||||
<span class='fraction'>12/12</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class='fl pad1y space-right2'>
|
|
||||||
<span class="strong">100% </span>
|
|
||||||
<span class="quiet">Branches</span>
|
|
||||||
<span class='fraction'>0/0</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class='fl pad1y space-right2'>
|
|
||||||
<span class="strong">100% </span>
|
|
||||||
<span class="quiet">Functions</span>
|
|
||||||
<span class='fraction'>0/0</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class='fl pad1y space-right2'>
|
|
||||||
<span class="strong">100% </span>
|
|
||||||
<span class="quiet">Lines</span>
|
|
||||||
<span class='fraction'>12/12</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<p class="quiet">
|
|
||||||
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
|
|
||||||
</p>
|
|
||||||
<template id="filterTemplate">
|
|
||||||
<div class="quiet">
|
|
||||||
Filter:
|
|
||||||
<input type="search" id="fileSearch">
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</div>
|
|
||||||
<div class='status-line high'></div>
|
|
||||||
<div class="pad1">
|
|
||||||
<table class="coverage-summary">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
|
|
||||||
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
|
|
||||||
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
|
|
||||||
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
|
|
||||||
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
|
|
||||||
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
|
|
||||||
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
|
|
||||||
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
|
|
||||||
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
|
|
||||||
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody><tr>
|
|
||||||
<td class="file high" data-value="index.ts"><a href="index.ts.html">index.ts</a></td>
|
|
||||||
<td data-value="100" class="pic high">
|
|
||||||
<div class="chart"><div class="cover-fill cover-full" style="width: 100%"></div><div class="cover-empty" style="width: 0%"></div></div>
|
|
||||||
</td>
|
|
||||||
<td data-value="100" class="pct high">100%</td>
|
|
||||||
<td data-value="12" class="abs high">12/12</td>
|
|
||||||
<td data-value="100" class="pct high">100%</td>
|
|
||||||
<td data-value="0" class="abs high">0/0</td>
|
|
||||||
<td data-value="100" class="pct high">100%</td>
|
|
||||||
<td data-value="0" class="abs high">0/0</td>
|
|
||||||
<td data-value="100" class="pct high">100%</td>
|
|
||||||
<td data-value="12" class="abs high">12/12</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
<div class='push'></div><!-- for sticky footer -->
|
|
||||||
</div><!-- /wrapper -->
|
|
||||||
<div class='footer quiet pad2 space-top1 center small'>
|
|
||||||
Code coverage generated by
|
|
||||||
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
||||||
at 2026-05-30T19:44:00.925Z
|
|
||||||
</div>
|
|
||||||
<script src="../prettify.js"></script>
|
|
||||||
<script>
|
|
||||||
window.onload = function () {
|
|
||||||
prettyPrint();
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
<script src="../sorter.js"></script>
|
|
||||||
<script src="../block-navigation.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
||||||
|
|
@ -1,121 +0,0 @@
|
||||||
|
|
||||||
<!doctype html>
|
|
||||||
<html lang="en">
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<title>Code coverage report for src/index.ts</title>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<link rel="stylesheet" href="../prettify.css" />
|
|
||||||
<link rel="stylesheet" href="../base.css" />
|
|
||||||
<link rel="shortcut icon" type="image/x-icon" href="../favicon.png" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
||||||
<style type='text/css'>
|
|
||||||
.coverage-summary .sorter {
|
|
||||||
background-image: url(../sort-arrow-sprite.png);
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<div class='wrapper'>
|
|
||||||
<div class='pad1'>
|
|
||||||
<h1><a href="../index.html">All files</a> / <a href="index.html">src</a> index.ts</h1>
|
|
||||||
<div class='clearfix'>
|
|
||||||
|
|
||||||
<div class='fl pad1y space-right2'>
|
|
||||||
<span class="strong">100% </span>
|
|
||||||
<span class="quiet">Statements</span>
|
|
||||||
<span class='fraction'>12/12</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class='fl pad1y space-right2'>
|
|
||||||
<span class="strong">100% </span>
|
|
||||||
<span class="quiet">Branches</span>
|
|
||||||
<span class='fraction'>0/0</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class='fl pad1y space-right2'>
|
|
||||||
<span class="strong">100% </span>
|
|
||||||
<span class="quiet">Functions</span>
|
|
||||||
<span class='fraction'>0/0</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class='fl pad1y space-right2'>
|
|
||||||
<span class="strong">100% </span>
|
|
||||||
<span class="quiet">Lines</span>
|
|
||||||
<span class='fraction'>12/12</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<p class="quiet">
|
|
||||||
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
|
|
||||||
</p>
|
|
||||||
<template id="filterTemplate">
|
|
||||||
<div class="quiet">
|
|
||||||
Filter:
|
|
||||||
<input type="search" id="fileSearch">
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</div>
|
|
||||||
<div class='status-line high'></div>
|
|
||||||
<pre><table class="coverage">
|
|
||||||
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
|
|
||||||
<a name='L2'></a><a href='#L2'>2</a>
|
|
||||||
<a name='L3'></a><a href='#L3'>3</a>
|
|
||||||
<a name='L4'></a><a href='#L4'>4</a>
|
|
||||||
<a name='L5'></a><a href='#L5'>5</a>
|
|
||||||
<a name='L6'></a><a href='#L6'>6</a>
|
|
||||||
<a name='L7'></a><a href='#L7'>7</a>
|
|
||||||
<a name='L8'></a><a href='#L8'>8</a>
|
|
||||||
<a name='L9'></a><a href='#L9'>9</a>
|
|
||||||
<a name='L10'></a><a href='#L10'>10</a>
|
|
||||||
<a name='L11'></a><a href='#L11'>11</a>
|
|
||||||
<a name='L12'></a><a href='#L12'>12</a>
|
|
||||||
<a name='L13'></a><a href='#L13'>13</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-yes">1x</span>
|
|
||||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">export { HijriCalendar } from './calendars/HijriCalendar';
|
|
||||||
export { UaqCalendar } from './calendars/UaqCalendar';
|
|
||||||
export { FcnaCalendar } from './calendars/FcnaCalendar';
|
|
||||||
|
|
||||||
export type { HijriDate, CalendarEngine, ConversionOptions } from 'hijri-core';
|
|
||||||
|
|
||||||
// Pre-built singletons. Import and use directly; no need to instantiate.
|
|
||||||
import { UaqCalendar } from './calendars/UaqCalendar';
|
|
||||||
import { FcnaCalendar } from './calendars/FcnaCalendar';
|
|
||||||
|
|
||||||
export const uaqCalendar = new UaqCalendar();
|
|
||||||
export const fcnaCalendar = new FcnaCalendar();
|
|
||||||
</pre></td></tr></table></pre>
|
|
||||||
|
|
||||||
<div class='push'></div><!-- for sticky footer -->
|
|
||||||
</div><!-- /wrapper -->
|
|
||||||
<div class='footer quiet pad2 space-top1 center small'>
|
|
||||||
Code coverage generated by
|
|
||||||
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
||||||
at 2026-05-30T19:44:00.925Z
|
|
||||||
</div>
|
|
||||||
<script src="../prettify.js"></script>
|
|
||||||
<script>
|
|
||||||
window.onload = function () {
|
|
||||||
prettyPrint();
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
<script src="../sorter.js"></script>
|
|
||||||
<script src="../block-navigation.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
||||||
|
|
@ -1,571 +0,0 @@
|
||||||
TN:
|
|
||||||
SF:src/index.ts
|
|
||||||
FNF:0
|
|
||||||
FNH:0
|
|
||||||
DA:1,1
|
|
||||||
DA:2,1
|
|
||||||
DA:3,1
|
|
||||||
DA:4,1
|
|
||||||
DA:5,1
|
|
||||||
DA:6,1
|
|
||||||
DA:7,1
|
|
||||||
DA:8,1
|
|
||||||
DA:9,1
|
|
||||||
DA:10,1
|
|
||||||
DA:11,1
|
|
||||||
DA:12,1
|
|
||||||
LF:12
|
|
||||||
LH:12
|
|
||||||
BRF:0
|
|
||||||
BRH:0
|
|
||||||
end_of_record
|
|
||||||
TN:
|
|
||||||
SF:src/calendars/FcnaCalendar.ts
|
|
||||||
FN:19,FcnaCalendar
|
|
||||||
FNF:1
|
|
||||||
FNH:1
|
|
||||||
FNDA:2,FcnaCalendar
|
|
||||||
DA:1,1
|
|
||||||
DA:2,1
|
|
||||||
DA:3,1
|
|
||||||
DA:4,1
|
|
||||||
DA:5,1
|
|
||||||
DA:6,1
|
|
||||||
DA:7,1
|
|
||||||
DA:8,1
|
|
||||||
DA:9,1
|
|
||||||
DA:10,1
|
|
||||||
DA:11,1
|
|
||||||
DA:12,1
|
|
||||||
DA:13,1
|
|
||||||
DA:14,1
|
|
||||||
DA:15,1
|
|
||||||
DA:16,1
|
|
||||||
DA:17,1
|
|
||||||
DA:18,1
|
|
||||||
DA:19,1
|
|
||||||
DA:20,2
|
|
||||||
DA:21,2
|
|
||||||
DA:22,1
|
|
||||||
LF:22
|
|
||||||
LH:22
|
|
||||||
BRDA:19,0,0,2
|
|
||||||
BRF:1
|
|
||||||
BRH:1
|
|
||||||
end_of_record
|
|
||||||
TN:
|
|
||||||
SF:src/calendars/HijriCalendar.ts
|
|
||||||
FN:15,borrowHijriDiff
|
|
||||||
FN:61,HijriCalendar
|
|
||||||
FN:66,toString
|
|
||||||
FN:79,toHijri
|
|
||||||
FN:94,fromHijri
|
|
||||||
FN:112,resolveOverflow
|
|
||||||
FN:119,applyOverflow
|
|
||||||
FN:133,year
|
|
||||||
FN:137,month
|
|
||||||
FN:146,monthCode
|
|
||||||
FN:151,day
|
|
||||||
FN:157,daysInMonth
|
|
||||||
FN:166,daysInYear
|
|
||||||
FN:175,monthsInYear
|
|
||||||
FN:179,inLeapYear
|
|
||||||
FN:190,dayOfWeek
|
|
||||||
FN:198,dayOfYear
|
|
||||||
FN:208,weekOfYear
|
|
||||||
FN:212,daysInWeek
|
|
||||||
FN:222,fields
|
|
||||||
FN:228,dateFromFields
|
|
||||||
FN:243,yearMonthFromFields
|
|
||||||
FN:266,monthDayFromFields
|
|
||||||
FN:295,dateAdd
|
|
||||||
FN:333,dateUntil
|
|
||||||
FN:363,mergeFields
|
|
||||||
FNF:26
|
|
||||||
FNH:23
|
|
||||||
FNDA:2,borrowHijriDiff
|
|
||||||
FNDA:4,HijriCalendar
|
|
||||||
FNDA:0,toString
|
|
||||||
FNDA:30,toHijri
|
|
||||||
FNDA:13,fromHijri
|
|
||||||
FNDA:10,resolveOverflow
|
|
||||||
FNDA:9,applyOverflow
|
|
||||||
FNDA:5,year
|
|
||||||
FNDA:7,month
|
|
||||||
FNDA:1,monthCode
|
|
||||||
FNDA:4,day
|
|
||||||
FNDA:1,daysInMonth
|
|
||||||
FNDA:2,daysInYear
|
|
||||||
FNDA:1,monthsInYear
|
|
||||||
FNDA:2,inLeapYear
|
|
||||||
FNDA:1,dayOfWeek
|
|
||||||
FNDA:1,dayOfYear
|
|
||||||
FNDA:0,weekOfYear
|
|
||||||
FNDA:1,daysInWeek
|
|
||||||
FNDA:2,fields
|
|
||||||
FNDA:5,dateFromFields
|
|
||||||
FNDA:1,yearMonthFromFields
|
|
||||||
FNDA:4,monthDayFromFields
|
|
||||||
FNDA:5,dateAdd
|
|
||||||
FNDA:4,dateUntil
|
|
||||||
FNDA:0,mergeFields
|
|
||||||
DA:1,1
|
|
||||||
DA:2,1
|
|
||||||
DA:3,1
|
|
||||||
DA:4,1
|
|
||||||
DA:5,1
|
|
||||||
DA:6,1
|
|
||||||
DA:7,1
|
|
||||||
DA:8,1
|
|
||||||
DA:9,1
|
|
||||||
DA:10,1
|
|
||||||
DA:11,1
|
|
||||||
DA:12,1
|
|
||||||
DA:13,1
|
|
||||||
DA:14,1
|
|
||||||
DA:15,2
|
|
||||||
DA:16,2
|
|
||||||
DA:17,2
|
|
||||||
DA:18,2
|
|
||||||
DA:19,2
|
|
||||||
DA:20,2
|
|
||||||
DA:21,2
|
|
||||||
DA:22,2
|
|
||||||
DA:23,2
|
|
||||||
DA:24,0
|
|
||||||
DA:25,0
|
|
||||||
DA:26,0
|
|
||||||
DA:27,0
|
|
||||||
DA:28,0
|
|
||||||
DA:29,0
|
|
||||||
DA:30,0
|
|
||||||
DA:31,0
|
|
||||||
DA:32,0
|
|
||||||
DA:33,2
|
|
||||||
DA:34,2
|
|
||||||
DA:35,2
|
|
||||||
DA:36,0
|
|
||||||
DA:37,0
|
|
||||||
DA:38,0
|
|
||||||
DA:39,2
|
|
||||||
DA:40,2
|
|
||||||
DA:41,2
|
|
||||||
DA:42,1
|
|
||||||
DA:43,1
|
|
||||||
DA:44,1
|
|
||||||
DA:45,1
|
|
||||||
DA:46,1
|
|
||||||
DA:47,1
|
|
||||||
DA:48,1
|
|
||||||
DA:49,1
|
|
||||||
DA:50,1
|
|
||||||
DA:51,1
|
|
||||||
DA:52,1
|
|
||||||
DA:53,1
|
|
||||||
DA:54,1
|
|
||||||
DA:55,1
|
|
||||||
DA:56,1
|
|
||||||
DA:57,1
|
|
||||||
DA:58,1
|
|
||||||
DA:59,1
|
|
||||||
DA:60,1
|
|
||||||
DA:61,1
|
|
||||||
DA:62,4
|
|
||||||
DA:63,4
|
|
||||||
DA:64,4
|
|
||||||
DA:65,1
|
|
||||||
DA:66,1
|
|
||||||
DA:67,0
|
|
||||||
DA:68,0
|
|
||||||
DA:69,1
|
|
||||||
DA:70,1
|
|
||||||
DA:71,1
|
|
||||||
DA:72,1
|
|
||||||
DA:73,1
|
|
||||||
DA:74,1
|
|
||||||
DA:75,1
|
|
||||||
DA:76,1
|
|
||||||
DA:77,1
|
|
||||||
DA:78,1
|
|
||||||
DA:79,1
|
|
||||||
DA:80,30
|
|
||||||
DA:81,30
|
|
||||||
DA:82,30
|
|
||||||
DA:83,1
|
|
||||||
DA:84,1
|
|
||||||
DA:85,29
|
|
||||||
DA:86,30
|
|
||||||
DA:87,1
|
|
||||||
DA:88,1
|
|
||||||
DA:89,1
|
|
||||||
DA:90,1
|
|
||||||
DA:91,1
|
|
||||||
DA:92,1
|
|
||||||
DA:93,1
|
|
||||||
DA:94,1
|
|
||||||
DA:95,13
|
|
||||||
DA:96,13
|
|
||||||
DA:97,0
|
|
||||||
DA:98,0
|
|
||||||
DA:99,0
|
|
||||||
DA:100,0
|
|
||||||
DA:101,13
|
|
||||||
DA:102,13
|
|
||||||
DA:103,13
|
|
||||||
DA:104,13
|
|
||||||
DA:105,13
|
|
||||||
DA:106,13
|
|
||||||
DA:107,1
|
|
||||||
DA:108,1
|
|
||||||
DA:109,1
|
|
||||||
DA:110,1
|
|
||||||
DA:111,1
|
|
||||||
DA:112,1
|
|
||||||
DA:113,10
|
|
||||||
DA:114,10
|
|
||||||
DA:115,1
|
|
||||||
DA:116,1
|
|
||||||
DA:117,1
|
|
||||||
DA:118,1
|
|
||||||
DA:119,1
|
|
||||||
DA:120,9
|
|
||||||
DA:121,9
|
|
||||||
DA:122,9
|
|
||||||
DA:123,9
|
|
||||||
DA:124,9
|
|
||||||
DA:125,9
|
|
||||||
DA:126,2
|
|
||||||
DA:127,2
|
|
||||||
DA:128,7
|
|
||||||
DA:129,9
|
|
||||||
DA:130,1
|
|
||||||
DA:131,1
|
|
||||||
DA:132,1
|
|
||||||
DA:133,1
|
|
||||||
DA:134,5
|
|
||||||
DA:135,5
|
|
||||||
DA:136,1
|
|
||||||
DA:137,1
|
|
||||||
DA:138,7
|
|
||||||
DA:139,7
|
|
||||||
DA:140,1
|
|
||||||
DA:141,1
|
|
||||||
DA:142,1
|
|
||||||
DA:143,1
|
|
||||||
DA:144,1
|
|
||||||
DA:145,1
|
|
||||||
DA:146,1
|
|
||||||
DA:147,1
|
|
||||||
DA:148,1
|
|
||||||
DA:149,1
|
|
||||||
DA:150,1
|
|
||||||
DA:151,1
|
|
||||||
DA:152,4
|
|
||||||
DA:153,4
|
|
||||||
DA:154,1
|
|
||||||
DA:155,1
|
|
||||||
DA:156,1
|
|
||||||
DA:157,1
|
|
||||||
DA:158,1
|
|
||||||
DA:159,1
|
|
||||||
DA:160,1
|
|
||||||
DA:161,1
|
|
||||||
DA:162,1
|
|
||||||
DA:163,1
|
|
||||||
DA:164,1
|
|
||||||
DA:165,1
|
|
||||||
DA:166,1
|
|
||||||
DA:167,2
|
|
||||||
DA:168,2
|
|
||||||
DA:169,2
|
|
||||||
DA:170,24
|
|
||||||
DA:171,24
|
|
||||||
DA:172,2
|
|
||||||
DA:173,2
|
|
||||||
DA:174,1
|
|
||||||
DA:175,1
|
|
||||||
DA:176,1
|
|
||||||
DA:177,1
|
|
||||||
DA:178,1
|
|
||||||
DA:179,1
|
|
||||||
DA:180,2
|
|
||||||
DA:181,2
|
|
||||||
DA:182,1
|
|
||||||
DA:183,1
|
|
||||||
DA:184,1
|
|
||||||
DA:185,1
|
|
||||||
DA:186,1
|
|
||||||
DA:187,1
|
|
||||||
DA:188,1
|
|
||||||
DA:189,1
|
|
||||||
DA:190,1
|
|
||||||
DA:191,1
|
|
||||||
DA:192,1
|
|
||||||
DA:193,1
|
|
||||||
DA:194,1
|
|
||||||
DA:195,1
|
|
||||||
DA:196,1
|
|
||||||
DA:197,1
|
|
||||||
DA:198,1
|
|
||||||
DA:199,1
|
|
||||||
DA:200,1
|
|
||||||
DA:201,1
|
|
||||||
DA:202,8
|
|
||||||
DA:203,8
|
|
||||||
DA:204,1
|
|
||||||
DA:205,1
|
|
||||||
DA:206,1
|
|
||||||
DA:207,1
|
|
||||||
DA:208,1
|
|
||||||
DA:209,0
|
|
||||||
DA:210,0
|
|
||||||
DA:211,1
|
|
||||||
DA:212,1
|
|
||||||
DA:213,1
|
|
||||||
DA:214,1
|
|
||||||
DA:215,1
|
|
||||||
DA:216,1
|
|
||||||
DA:217,1
|
|
||||||
DA:218,1
|
|
||||||
DA:219,1
|
|
||||||
DA:220,1
|
|
||||||
DA:221,1
|
|
||||||
DA:222,1
|
|
||||||
DA:223,2
|
|
||||||
DA:224,2
|
|
||||||
DA:225,1
|
|
||||||
DA:226,1
|
|
||||||
DA:227,1
|
|
||||||
DA:228,1
|
|
||||||
DA:229,5
|
|
||||||
DA:230,5
|
|
||||||
DA:231,5
|
|
||||||
DA:232,5
|
|
||||||
DA:233,5
|
|
||||||
DA:234,5
|
|
||||||
DA:235,5
|
|
||||||
DA:236,5
|
|
||||||
DA:237,1
|
|
||||||
DA:238,1
|
|
||||||
DA:239,1
|
|
||||||
DA:240,1
|
|
||||||
DA:241,1
|
|
||||||
DA:242,1
|
|
||||||
DA:243,1
|
|
||||||
DA:244,1
|
|
||||||
DA:245,1
|
|
||||||
DA:246,1
|
|
||||||
DA:247,1
|
|
||||||
DA:248,1
|
|
||||||
DA:249,1
|
|
||||||
DA:250,1
|
|
||||||
DA:251,0
|
|
||||||
DA:252,0
|
|
||||||
DA:253,1
|
|
||||||
DA:254,1
|
|
||||||
DA:255,1
|
|
||||||
DA:256,1
|
|
||||||
DA:257,1
|
|
||||||
DA:258,1
|
|
||||||
DA:259,1
|
|
||||||
DA:260,1
|
|
||||||
DA:261,1
|
|
||||||
DA:262,1
|
|
||||||
DA:263,1
|
|
||||||
DA:264,1
|
|
||||||
DA:265,1
|
|
||||||
DA:266,1
|
|
||||||
DA:267,4
|
|
||||||
DA:268,4
|
|
||||||
DA:269,4
|
|
||||||
DA:270,4
|
|
||||||
DA:271,4
|
|
||||||
DA:272,4
|
|
||||||
DA:273,4
|
|
||||||
DA:274,4
|
|
||||||
DA:275,4
|
|
||||||
DA:276,4
|
|
||||||
DA:277,4
|
|
||||||
DA:278,4
|
|
||||||
DA:279,4
|
|
||||||
DA:280,1
|
|
||||||
DA:281,1
|
|
||||||
DA:282,1
|
|
||||||
DA:283,1
|
|
||||||
DA:284,1
|
|
||||||
DA:285,1
|
|
||||||
DA:286,1
|
|
||||||
DA:287,1
|
|
||||||
DA:288,1
|
|
||||||
DA:289,1
|
|
||||||
DA:290,1
|
|
||||||
DA:291,1
|
|
||||||
DA:292,1
|
|
||||||
DA:293,1
|
|
||||||
DA:294,1
|
|
||||||
DA:295,1
|
|
||||||
DA:296,5
|
|
||||||
DA:297,5
|
|
||||||
DA:298,5
|
|
||||||
DA:299,5
|
|
||||||
DA:300,5
|
|
||||||
DA:301,5
|
|
||||||
DA:302,5
|
|
||||||
DA:303,5
|
|
||||||
DA:304,5
|
|
||||||
DA:305,5
|
|
||||||
DA:306,5
|
|
||||||
DA:307,5
|
|
||||||
DA:308,5
|
|
||||||
DA:309,5
|
|
||||||
DA:310,5
|
|
||||||
DA:311,5
|
|
||||||
DA:312,0
|
|
||||||
DA:313,0
|
|
||||||
DA:314,0
|
|
||||||
DA:315,5
|
|
||||||
DA:316,5
|
|
||||||
DA:317,5
|
|
||||||
DA:318,5
|
|
||||||
DA:319,5
|
|
||||||
DA:320,5
|
|
||||||
DA:321,5
|
|
||||||
DA:322,5
|
|
||||||
DA:323,5
|
|
||||||
DA:324,5
|
|
||||||
DA:325,1
|
|
||||||
DA:326,1
|
|
||||||
DA:327,1
|
|
||||||
DA:328,1
|
|
||||||
DA:329,1
|
|
||||||
DA:330,1
|
|
||||||
DA:331,1
|
|
||||||
DA:332,1
|
|
||||||
DA:333,1
|
|
||||||
DA:334,4
|
|
||||||
DA:335,4
|
|
||||||
DA:336,4
|
|
||||||
DA:337,4
|
|
||||||
DA:338,4
|
|
||||||
DA:339,4
|
|
||||||
DA:340,4
|
|
||||||
DA:341,1
|
|
||||||
DA:342,1
|
|
||||||
DA:343,1
|
|
||||||
DA:344,1
|
|
||||||
DA:345,1
|
|
||||||
DA:346,3
|
|
||||||
DA:347,4
|
|
||||||
DA:348,1
|
|
||||||
DA:349,1
|
|
||||||
DA:350,1
|
|
||||||
DA:351,1
|
|
||||||
DA:352,1
|
|
||||||
DA:353,1
|
|
||||||
DA:354,2
|
|
||||||
DA:355,2
|
|
||||||
DA:356,4
|
|
||||||
DA:357,1
|
|
||||||
DA:358,1
|
|
||||||
DA:359,1
|
|
||||||
DA:360,1
|
|
||||||
DA:361,4
|
|
||||||
DA:362,1
|
|
||||||
DA:363,1
|
|
||||||
DA:364,0
|
|
||||||
DA:365,0
|
|
||||||
DA:366,0
|
|
||||||
DA:367,0
|
|
||||||
DA:368,0
|
|
||||||
DA:369,1
|
|
||||||
LF:369
|
|
||||||
LH:339
|
|
||||||
BRDA:15,0,0,2
|
|
||||||
BRDA:23,1,0,0
|
|
||||||
BRDA:35,2,0,0
|
|
||||||
BRDA:61,3,0,4
|
|
||||||
BRDA:79,4,0,30
|
|
||||||
BRDA:82,5,0,1
|
|
||||||
BRDA:84,6,0,29
|
|
||||||
BRDA:94,7,0,13
|
|
||||||
BRDA:96,8,0,0
|
|
||||||
BRDA:112,9,0,10
|
|
||||||
BRDA:113,10,0,4
|
|
||||||
BRDA:113,11,0,6
|
|
||||||
BRDA:119,12,0,9
|
|
||||||
BRDA:125,13,0,2
|
|
||||||
BRDA:125,14,0,2
|
|
||||||
BRDA:127,15,0,7
|
|
||||||
BRDA:133,16,0,5
|
|
||||||
BRDA:137,17,0,7
|
|
||||||
BRDA:146,18,0,1
|
|
||||||
BRDA:151,19,0,4
|
|
||||||
BRDA:157,20,0,1
|
|
||||||
BRDA:166,21,0,2
|
|
||||||
BRDA:169,22,0,24
|
|
||||||
BRDA:175,23,0,1
|
|
||||||
BRDA:179,24,0,2
|
|
||||||
BRDA:190,25,0,1
|
|
||||||
BRDA:198,26,0,1
|
|
||||||
BRDA:201,27,0,8
|
|
||||||
BRDA:212,28,0,1
|
|
||||||
BRDA:222,29,0,2
|
|
||||||
BRDA:228,30,0,5
|
|
||||||
BRDA:243,31,0,1
|
|
||||||
BRDA:250,32,0,0
|
|
||||||
BRDA:250,33,0,0
|
|
||||||
BRDA:266,34,0,4
|
|
||||||
BRDA:271,35,0,3
|
|
||||||
BRDA:295,36,0,5
|
|
||||||
BRDA:302,37,0,0
|
|
||||||
BRDA:303,38,0,0
|
|
||||||
BRDA:311,39,0,0
|
|
||||||
BRDA:322,40,0,0
|
|
||||||
BRDA:322,41,0,0
|
|
||||||
BRDA:323,42,0,2
|
|
||||||
BRDA:323,43,0,3
|
|
||||||
BRDA:333,44,0,4
|
|
||||||
BRDA:338,45,0,0
|
|
||||||
BRDA:340,46,0,3
|
|
||||||
BRDA:340,47,0,1
|
|
||||||
BRDA:345,48,0,3
|
|
||||||
BRDA:347,49,0,2
|
|
||||||
BRDA:347,50,0,1
|
|
||||||
BRDA:353,51,0,2
|
|
||||||
BRDA:356,52,0,1
|
|
||||||
BRDA:356,53,0,1
|
|
||||||
BRF:54
|
|
||||||
BRH:43
|
|
||||||
end_of_record
|
|
||||||
TN:
|
|
||||||
SF:src/calendars/UaqCalendar.ts
|
|
||||||
FN:17,UaqCalendar
|
|
||||||
FNF:1
|
|
||||||
FNH:1
|
|
||||||
FNDA:2,UaqCalendar
|
|
||||||
DA:1,1
|
|
||||||
DA:2,1
|
|
||||||
DA:3,1
|
|
||||||
DA:4,1
|
|
||||||
DA:5,1
|
|
||||||
DA:6,1
|
|
||||||
DA:7,1
|
|
||||||
DA:8,1
|
|
||||||
DA:9,1
|
|
||||||
DA:10,1
|
|
||||||
DA:11,1
|
|
||||||
DA:12,1
|
|
||||||
DA:13,1
|
|
||||||
DA:14,1
|
|
||||||
DA:15,1
|
|
||||||
DA:16,1
|
|
||||||
DA:17,1
|
|
||||||
DA:18,2
|
|
||||||
DA:19,2
|
|
||||||
DA:20,1
|
|
||||||
LF:20
|
|
||||||
LH:20
|
|
||||||
BRDA:17,0,0,2
|
|
||||||
BRF:1
|
|
||||||
BRH:1
|
|
||||||
end_of_record
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1,16 +1,20 @@
|
||||||
import tsParser from '@typescript-eslint/parser';
|
import tsParser from "@typescript-eslint/parser";
|
||||||
import tsPlugin from '@typescript-eslint/eslint-plugin';
|
import tsPlugin from "@typescript-eslint/eslint-plugin";
|
||||||
import eslintConfigPrettier from 'eslint-config-prettier';
|
import eslintConfigPrettier from "eslint-config-prettier";
|
||||||
import { typescript } from '@acamarata/eslint-config';
|
import { typescript } from "@acamarata/eslint-config";
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
plugins: { '@typescript-eslint': tsPlugin },
|
files: ["**/*.ts"],
|
||||||
languageOptions: { parser: tsParser },
|
plugins: { "@typescript-eslint": tsPlugin },
|
||||||
|
languageOptions: {
|
||||||
|
parser: tsParser,
|
||||||
|
parserOptions: { project: true, tsconfigRootDir: import.meta.dirname },
|
||||||
},
|
},
|
||||||
...typescript,
|
},
|
||||||
|
...typescript.map((config) => ({ files: ["**/*.ts"], ...config })),
|
||||||
eslintConfigPrettier,
|
eslintConfigPrettier,
|
||||||
{
|
{
|
||||||
ignores: ['dist/', 'node_modules/', 'test.mjs', 'test-cjs.cjs'],
|
ignores: ["dist/", "node_modules/", "test.mjs", "test-cjs.cjs"],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
|
||||||
11
package.json
11
package.json
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "temporal-hijri",
|
"name": "temporal-hijri",
|
||||||
"version": "1.0.2",
|
"version": "1.0.3",
|
||||||
"description": "Temporal Calendar Protocol implementation for the Hijri calendar system. Supports Umm al-Qura and FCNA calendars via hijri-core.",
|
"description": "Temporal Calendar Protocol implementation for the Hijri calendar system. Supports Umm al-Qura and FCNA calendars via hijri-core.",
|
||||||
"author": "Aric Camarata",
|
"author": "Aric Camarata",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|
@ -37,7 +37,7 @@
|
||||||
"format:check": "prettier --check src/ test.mjs test-cjs.cjs eslint.config.mjs tsup.config.ts",
|
"format:check": "prettier --check src/ test.mjs test-cjs.cjs eslint.config.mjs tsup.config.ts",
|
||||||
"pretest": "tsup",
|
"pretest": "tsup",
|
||||||
"test": "node --test test.mjs && node --test test-cjs.cjs",
|
"test": "node --test test.mjs && node --test test-cjs.cjs",
|
||||||
"prepublishOnly": "tsup",
|
"prepack": "pnpm run build",
|
||||||
"coverage": "c8 --reporter=lcov --reporter=text node test.mjs",
|
"coverage": "c8 --reporter=lcov --reporter=text node test.mjs",
|
||||||
"docs": "typedoc --out .github/wiki/api src/index.ts",
|
"docs": "typedoc --out .github/wiki/api src/index.ts",
|
||||||
"postbuild": "cp dist/index.d.ts dist/index.d.mts"
|
"postbuild": "cp dist/index.d.ts dist/index.d.mts"
|
||||||
|
|
@ -70,16 +70,19 @@
|
||||||
"@eslint/js": "^10.0.1",
|
"@eslint/js": "^10.0.1",
|
||||||
"@js-temporal/polyfill": "^0.4.4",
|
"@js-temporal/polyfill": "^0.4.4",
|
||||||
"@types/node": "^22.0.0",
|
"@types/node": "^22.0.0",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^8.56.1",
|
||||||
|
"@typescript-eslint/parser": "^8.56.1",
|
||||||
"c8": "^11.0.0",
|
"c8": "^11.0.0",
|
||||||
"eslint": "^10.0.3",
|
"eslint": "^10.0.3",
|
||||||
"eslint-config-prettier": "^10.1.8",
|
"eslint-config-prettier": "^10.1.8",
|
||||||
"hijri-core": "^1.0.0",
|
"hijri-core": "^1.0.3",
|
||||||
"prettier": "^3.8.1",
|
"prettier": "^3.8.1",
|
||||||
"tsup": "^8.0.0",
|
"tsup": "^8.0.0",
|
||||||
"typedoc": "^0.28.19",
|
"typedoc": "^0.28.19",
|
||||||
"typedoc-plugin-markdown": "^4.11.0",
|
"typedoc-plugin-markdown": "^4.11.0",
|
||||||
"typescript": "^5.5.0",
|
"typescript": "^5.5.0",
|
||||||
"typescript-eslint": "^8.56.1"
|
"typescript-eslint": "^8.56.1",
|
||||||
|
"@acamarata/telemetry": "^0.1.0"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public",
|
"access": "public",
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,9 @@ importers:
|
||||||
'@acamarata/prettier-config':
|
'@acamarata/prettier-config':
|
||||||
specifier: ^0.1.0
|
specifier: ^0.1.0
|
||||||
version: 0.1.0(prettier@3.8.1)
|
version: 0.1.0(prettier@3.8.1)
|
||||||
|
'@acamarata/telemetry':
|
||||||
|
specifier: ^0.1.0
|
||||||
|
version: 0.1.0
|
||||||
'@acamarata/tsconfig':
|
'@acamarata/tsconfig':
|
||||||
specifier: ^0.1.0
|
specifier: ^0.1.0
|
||||||
version: 0.1.0
|
version: 0.1.0
|
||||||
|
|
@ -26,6 +29,12 @@ importers:
|
||||||
'@types/node':
|
'@types/node':
|
||||||
specifier: ^22.0.0
|
specifier: ^22.0.0
|
||||||
version: 22.19.11
|
version: 22.19.11
|
||||||
|
'@typescript-eslint/eslint-plugin':
|
||||||
|
specifier: ^8.56.1
|
||||||
|
version: 8.56.1(@typescript-eslint/parser@8.56.1(eslint@10.0.3)(typescript@5.9.3))(eslint@10.0.3)(typescript@5.9.3)
|
||||||
|
'@typescript-eslint/parser':
|
||||||
|
specifier: ^8.56.1
|
||||||
|
version: 8.56.1(eslint@10.0.3)(typescript@5.9.3)
|
||||||
c8:
|
c8:
|
||||||
specifier: ^11.0.0
|
specifier: ^11.0.0
|
||||||
version: 11.0.0
|
version: 11.0.0
|
||||||
|
|
@ -36,8 +45,8 @@ importers:
|
||||||
specifier: ^10.1.8
|
specifier: ^10.1.8
|
||||||
version: 10.1.8(eslint@10.0.3)
|
version: 10.1.8(eslint@10.0.3)
|
||||||
hijri-core:
|
hijri-core:
|
||||||
specifier: ^1.0.0
|
specifier: ^1.0.3
|
||||||
version: 1.0.0
|
version: 1.0.3
|
||||||
prettier:
|
prettier:
|
||||||
specifier: ^3.8.1
|
specifier: ^3.8.1
|
||||||
version: 3.8.1
|
version: 3.8.1
|
||||||
|
|
@ -81,6 +90,10 @@ packages:
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
prettier: '>=3.0.0'
|
prettier: '>=3.0.0'
|
||||||
|
|
||||||
|
'@acamarata/telemetry@0.1.0':
|
||||||
|
resolution: {integrity: sha512-iP09ZD0bHencHLbv6kQZDgwN9crLCWGKxmiMrfJjhBCoWTgv4koSgg0Li/LFKwCCFluua6orj9fVeQ8eqcJXSQ==}
|
||||||
|
engines: {node: '>=20'}
|
||||||
|
|
||||||
'@acamarata/tsconfig@0.1.0':
|
'@acamarata/tsconfig@0.1.0':
|
||||||
resolution: {integrity: sha512-bgzyBak43mE+0HhduZX3cvaPjKcggtGGZZMjr35qtYWolsIWgZ9nx7OOswbVYoU35qoUv6rZ0mTK6GbZ8QTYjw==}
|
resolution: {integrity: sha512-bgzyBak43mE+0HhduZX3cvaPjKcggtGGZZMjr35qtYWolsIWgZ9nx7OOswbVYoU35qoUv6rZ0mTK6GbZ8QTYjw==}
|
||||||
engines: {node: '>=20'}
|
engines: {node: '>=20'}
|
||||||
|
|
@ -790,8 +803,8 @@ packages:
|
||||||
resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==}
|
resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==}
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
|
|
||||||
hijri-core@1.0.0:
|
hijri-core@1.0.3:
|
||||||
resolution: {integrity: sha512-wImBZLBKbEWEEUE1nrc1CFY/uvx4XjGNWYChImJZlswXIVhrBCzSVaj6DP1AU2gUMJ6KDh2ygXo/u/Qx232CXA==}
|
resolution: {integrity: sha512-ONT5gp+Z/lzT/BbWKS0F8lcKK9T/H6jc95NLQE4Angdt7Uimo4KkmSt/qn9odaQRp1pX0RjA65QRcR4miF7XxA==}
|
||||||
engines: {node: '>=20'}
|
engines: {node: '>=20'}
|
||||||
|
|
||||||
html-escaper@2.0.2:
|
html-escaper@2.0.2:
|
||||||
|
|
@ -1202,6 +1215,8 @@ snapshots:
|
||||||
dependencies:
|
dependencies:
|
||||||
prettier: 3.8.1
|
prettier: 3.8.1
|
||||||
|
|
||||||
|
'@acamarata/telemetry@0.1.0': {}
|
||||||
|
|
||||||
'@acamarata/tsconfig@0.1.0': {}
|
'@acamarata/tsconfig@0.1.0': {}
|
||||||
|
|
||||||
'@bcoe/v8-coverage@1.0.2': {}
|
'@bcoe/v8-coverage@1.0.2': {}
|
||||||
|
|
@ -1811,7 +1826,7 @@ snapshots:
|
||||||
|
|
||||||
has-flag@4.0.0: {}
|
has-flag@4.0.0: {}
|
||||||
|
|
||||||
hijri-core@1.0.0: {}
|
hijri-core@1.0.3: {}
|
||||||
|
|
||||||
html-escaper@2.0.2: {}
|
html-escaper@2.0.2: {}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { getCalendar } from 'hijri-core';
|
import { getCalendar } from "hijri-core";
|
||||||
import { HijriCalendar } from './HijriCalendar';
|
import { HijriCalendar } from "./HijriCalendar";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Temporal calendar implementation for the FCNA/ISNA calendar.
|
* Temporal calendar implementation for the FCNA/ISNA calendar.
|
||||||
|
|
@ -17,6 +17,6 @@ import { HijriCalendar } from './HijriCalendar';
|
||||||
*/
|
*/
|
||||||
export class FcnaCalendar extends HijriCalendar {
|
export class FcnaCalendar extends HijriCalendar {
|
||||||
constructor() {
|
constructor() {
|
||||||
super(getCalendar('fcna'));
|
super(getCalendar("fcna"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { Temporal } from '@js-temporal/polyfill';
|
import { Temporal } from "@js-temporal/polyfill";
|
||||||
import type { CalendarEngine } from 'hijri-core';
|
import type { CalendarEngine } from "hijri-core";
|
||||||
|
|
||||||
type DateUnit = 'year' | 'years' | 'month' | 'months' | 'week' | 'weeks' | 'day' | 'days';
|
type DateUnit = "year" | "years" | "month" | "months" | "week" | "weeks" | "day" | "days";
|
||||||
|
|
||||||
/** Reference year for monthDay construction when no year is specified. */
|
/** Reference year for monthDay construction when no year is specified. */
|
||||||
const REFERENCE_YEAR = 1444;
|
const REFERENCE_YEAR = 1444;
|
||||||
|
|
@ -70,14 +70,14 @@ export class HijriCalendar {
|
||||||
/**
|
/**
|
||||||
* Convert a Temporal.PlainDate (ISO calendar) to Hijri coordinates.
|
* Convert a Temporal.PlainDate (ISO calendar) to Hijri coordinates.
|
||||||
*
|
*
|
||||||
* Uses the local-time Date constructor so that the date components passed to
|
* PlainDate calendar fields are placed in the Date's UTC components via
|
||||||
* the engine match the calendar date exactly, regardless of host timezone.
|
* Date.UTC() because hijri-core reads the UTC calendar day. This ensures
|
||||||
* The UAQ engine reads local components; the FCNA engine reads UTC components.
|
* the conversion returns the correct Hijri date on every host timezone:
|
||||||
* Because we construct with new Date(y, m, d) the local date always matches
|
* without Date.UTC, on east-of-UTC hosts (e.g. UTC+5) the local midnight
|
||||||
* the intended calendar date.
|
* falls on the previous UTC day, causing a one-day-off result.
|
||||||
*/
|
*/
|
||||||
protected toHijri(date: Temporal.PlainDate): { hy: number; hm: number; hd: number } {
|
protected toHijri(date: Temporal.PlainDate): { hy: number; hm: number; hd: number } {
|
||||||
const jsDate = new Date(date.year, date.month - 1, date.day);
|
const jsDate = new Date(Date.UTC(date.year, date.month - 1, date.day));
|
||||||
const hijri = this.engine.toHijri(jsDate);
|
const hijri = this.engine.toHijri(jsDate);
|
||||||
if (!hijri) {
|
if (!hijri) {
|
||||||
throw new RangeError(`Date ${date.toString()} is out of range for the ${this.id} calendar`);
|
throw new RangeError(`Date ${date.toString()} is out of range for the ${this.id} calendar`);
|
||||||
|
|
@ -109,8 +109,8 @@ export class HijriCalendar {
|
||||||
* Resolve the overflow option from a Temporal options bag.
|
* Resolve the overflow option from a Temporal options bag.
|
||||||
* Returns 'constrain' (the default) or 'reject'.
|
* Returns 'constrain' (the default) or 'reject'.
|
||||||
*/
|
*/
|
||||||
private resolveOverflow(options?: { overflow?: 'constrain' | 'reject' }): 'constrain' | 'reject' {
|
private resolveOverflow(options?: { overflow?: "constrain" | "reject" }): "constrain" | "reject" {
|
||||||
return options?.overflow ?? 'constrain';
|
return options?.overflow ?? "constrain";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -120,9 +120,9 @@ export class HijriCalendar {
|
||||||
day: number,
|
day: number,
|
||||||
maxDay: number,
|
maxDay: number,
|
||||||
month: number,
|
month: number,
|
||||||
overflow: 'constrain' | 'reject',
|
overflow: "constrain" | "reject",
|
||||||
): number {
|
): number {
|
||||||
if (overflow === 'reject' && day > maxDay) {
|
if (overflow === "reject" && day > maxDay) {
|
||||||
throw new RangeError(`Day ${day} exceeds ${maxDay} days in month ${month}`);
|
throw new RangeError(`Day ${day} exceeds ${maxDay} days in month ${month}`);
|
||||||
}
|
}
|
||||||
return Math.min(day, maxDay);
|
return Math.min(day, maxDay);
|
||||||
|
|
@ -157,7 +157,7 @@ export class HijriCalendar {
|
||||||
*/
|
*/
|
||||||
monthCode(date: Temporal.PlainDate): string {
|
monthCode(date: Temporal.PlainDate): string {
|
||||||
const { hm } = this.toHijri(date);
|
const { hm } = this.toHijri(date);
|
||||||
return `M${String(hm).padStart(2, '0')}`;
|
return `M${String(hm).padStart(2, "0")}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -278,7 +278,7 @@ export class HijriCalendar {
|
||||||
|
|
||||||
dateFromFields(
|
dateFromFields(
|
||||||
fields: { year: number; month: number; day: number },
|
fields: { year: number; month: number; day: number },
|
||||||
options?: { overflow?: 'constrain' | 'reject' },
|
options?: { overflow?: "constrain" | "reject" },
|
||||||
): Temporal.PlainDate {
|
): Temporal.PlainDate {
|
||||||
const overflow = this.resolveOverflow(options);
|
const overflow = this.resolveOverflow(options);
|
||||||
const maxDay = this.engine.daysInMonth(fields.year, fields.month);
|
const maxDay = this.engine.daysInMonth(fields.year, fields.month);
|
||||||
|
|
@ -293,12 +293,12 @@ export class HijriCalendar {
|
||||||
*/
|
*/
|
||||||
yearMonthFromFields(
|
yearMonthFromFields(
|
||||||
fields: { year: number; month: number },
|
fields: { year: number; month: number },
|
||||||
options?: { overflow?: 'constrain' | 'reject' },
|
options?: { overflow?: "constrain" | "reject" },
|
||||||
): Temporal.PlainYearMonth {
|
): Temporal.PlainYearMonth {
|
||||||
const overflow = this.resolveOverflow(options);
|
const overflow = this.resolveOverflow(options);
|
||||||
// Clamp month to 1-12 or reject.
|
// Clamp month to 1-12 or reject.
|
||||||
const maxMonth = 12;
|
const maxMonth = 12;
|
||||||
if (overflow === 'reject' && (fields.month < 1 || fields.month > maxMonth)) {
|
if (overflow === "reject" && (fields.month < 1 || fields.month > maxMonth)) {
|
||||||
throw new RangeError(`Month ${fields.month} is out of range 1-${maxMonth}`);
|
throw new RangeError(`Month ${fields.month} is out of range 1-${maxMonth}`);
|
||||||
}
|
}
|
||||||
const month = Math.max(1, Math.min(fields.month, maxMonth));
|
const month = Math.max(1, Math.min(fields.month, maxMonth));
|
||||||
|
|
@ -316,7 +316,7 @@ export class HijriCalendar {
|
||||||
*/
|
*/
|
||||||
monthDayFromFields(
|
monthDayFromFields(
|
||||||
fields: { month: number; day: number; year?: number },
|
fields: { month: number; day: number; year?: number },
|
||||||
options?: { overflow?: 'constrain' | 'reject' },
|
options?: { overflow?: "constrain" | "reject" },
|
||||||
): Temporal.PlainMonthDay {
|
): Temporal.PlainMonthDay {
|
||||||
const overflow = this.resolveOverflow(options);
|
const overflow = this.resolveOverflow(options);
|
||||||
const year = fields.year ?? REFERENCE_YEAR;
|
const year = fields.year ?? REFERENCE_YEAR;
|
||||||
|
|
@ -346,7 +346,7 @@ export class HijriCalendar {
|
||||||
dateAdd(
|
dateAdd(
|
||||||
date: Temporal.PlainDate,
|
date: Temporal.PlainDate,
|
||||||
duration: Temporal.Duration,
|
duration: Temporal.Duration,
|
||||||
_options?: { overflow?: 'constrain' | 'reject' },
|
_options?: { overflow?: "constrain" | "reject" },
|
||||||
): Temporal.PlainDate {
|
): Temporal.PlainDate {
|
||||||
const { hy, hm, hd } = this.toHijri(date);
|
const { hy, hm, hd } = this.toHijri(date);
|
||||||
|
|
||||||
|
|
@ -386,16 +386,16 @@ export class HijriCalendar {
|
||||||
two: Temporal.PlainDate,
|
two: Temporal.PlainDate,
|
||||||
options?: { largestUnit?: DateUnit },
|
options?: { largestUnit?: DateUnit },
|
||||||
): Temporal.Duration {
|
): Temporal.Duration {
|
||||||
const largestUnit: DateUnit = options?.largestUnit ?? 'days';
|
const largestUnit: DateUnit = options?.largestUnit ?? "days";
|
||||||
|
|
||||||
if (largestUnit === 'years' || largestUnit === 'year') {
|
if (largestUnit === "years" || largestUnit === "year") {
|
||||||
const h1 = this.toHijri(one);
|
const h1 = this.toHijri(one);
|
||||||
const h2 = this.toHijri(two);
|
const h2 = this.toHijri(two);
|
||||||
const diff = borrowHijriDiff(this.engine, h2.hy - h1.hy, h2.hm - h1.hm, h2.hd - h1.hd, h2);
|
const diff = borrowHijriDiff(this.engine, h2.hy - h1.hy, h2.hm - h1.hm, h2.hd - h1.hd, h2);
|
||||||
return new Temporal.Duration(diff.years, diff.months, 0, diff.days);
|
return new Temporal.Duration(diff.years, diff.months, 0, diff.days);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (largestUnit === 'months' || largestUnit === 'month') {
|
if (largestUnit === "months" || largestUnit === "month") {
|
||||||
const h1 = this.toHijri(one);
|
const h1 = this.toHijri(one);
|
||||||
const h2 = this.toHijri(two);
|
const h2 = this.toHijri(two);
|
||||||
const diff = borrowHijriDiff(this.engine, h2.hy - h1.hy, h2.hm - h1.hm, h2.hd - h1.hd, h2);
|
const diff = borrowHijriDiff(this.engine, h2.hy - h1.hy, h2.hm - h1.hm, h2.hd - h1.hd, h2);
|
||||||
|
|
@ -404,11 +404,11 @@ export class HijriCalendar {
|
||||||
}
|
}
|
||||||
|
|
||||||
// For weeks and days, delegate to ISO arithmetic which is exact.
|
// For weeks and days, delegate to ISO arithmetic which is exact.
|
||||||
if (largestUnit === 'weeks' || largestUnit === 'week') {
|
if (largestUnit === "weeks" || largestUnit === "week") {
|
||||||
return one.until(two, { largestUnit: 'weeks' });
|
return one.until(two, { largestUnit: "weeks" });
|
||||||
}
|
}
|
||||||
|
|
||||||
return one.until(two, { largestUnit: 'days' });
|
return one.until(two, { largestUnit: "days" });
|
||||||
}
|
}
|
||||||
|
|
||||||
mergeFields(
|
mergeFields(
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { getCalendar } from 'hijri-core';
|
import { getCalendar } from "hijri-core";
|
||||||
import { HijriCalendar } from './HijriCalendar';
|
import { HijriCalendar } from "./HijriCalendar";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Temporal calendar implementation for the Umm al-Qura calendar.
|
* Temporal calendar implementation for the Umm al-Qura calendar.
|
||||||
|
|
@ -15,6 +15,6 @@ import { HijriCalendar } from './HijriCalendar';
|
||||||
*/
|
*/
|
||||||
export class UaqCalendar extends HijriCalendar {
|
export class UaqCalendar extends HijriCalendar {
|
||||||
constructor() {
|
constructor() {
|
||||||
super(getCalendar('uaq'));
|
super(getCalendar("uaq"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
21
src/index.ts
21
src/index.ts
|
|
@ -1,12 +1,21 @@
|
||||||
export { HijriCalendar } from './calendars/HijriCalendar';
|
export { HijriCalendar } from "./calendars/HijriCalendar";
|
||||||
export { UaqCalendar } from './calendars/UaqCalendar';
|
export { UaqCalendar } from "./calendars/UaqCalendar";
|
||||||
export { FcnaCalendar } from './calendars/FcnaCalendar';
|
export { FcnaCalendar } from "./calendars/FcnaCalendar";
|
||||||
|
|
||||||
export type { HijriDate, CalendarEngine, ConversionOptions } from 'hijri-core';
|
export type { HijriDate, CalendarEngine, ConversionOptions } from "hijri-core";
|
||||||
|
|
||||||
// Pre-built singletons. Import and use directly; no need to instantiate.
|
// Pre-built singletons. Import and use directly; no need to instantiate.
|
||||||
import { UaqCalendar } from './calendars/UaqCalendar';
|
import { UaqCalendar } from "./calendars/UaqCalendar";
|
||||||
import { FcnaCalendar } from './calendars/FcnaCalendar';
|
import { FcnaCalendar } from "./calendars/FcnaCalendar";
|
||||||
|
|
||||||
export const uaqCalendar = new UaqCalendar();
|
export const uaqCalendar = new UaqCalendar();
|
||||||
export const fcnaCalendar = new FcnaCalendar();
|
export const fcnaCalendar = new FcnaCalendar();
|
||||||
|
|
||||||
|
// ── Opt-in anonymous telemetry ────────────────────────────────────────────────
|
||||||
|
// Off by default. Enable: ACAMARATA_TELEMETRY=1
|
||||||
|
// What is sent + how to disable: https://github.com/acamarata/telemetry/blob/main/TELEMETRY.md
|
||||||
|
import("@acamarata/telemetry")
|
||||||
|
.then(({ track }) => track("load", { package: "temporal-hijri", version: "1.0.3" }))
|
||||||
|
.catch(() => {
|
||||||
|
// telemetry not installed or disabled — that is fine
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
export type { HijriDate, CalendarEngine, ConversionOptions } from 'hijri-core';
|
export type { HijriDate, CalendarEngine, ConversionOptions } from "hijri-core";
|
||||||
|
|
|
||||||
54
test-cjs.cjs
54
test-cjs.cjs
|
|
@ -1,4 +1,4 @@
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CJS test suite for temporal-hijri.
|
* CJS test suite for temporal-hijri.
|
||||||
|
|
@ -6,66 +6,66 @@
|
||||||
* Verifies that the CommonJS build loads and functions correctly via require().
|
* Verifies that the CommonJS build loads and functions correctly via require().
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const { describe, it } = require('node:test');
|
const { describe, it } = require("node:test");
|
||||||
const assert = require('node:assert/strict');
|
const assert = require("node:assert/strict");
|
||||||
const { Temporal } = require('@js-temporal/polyfill');
|
const { Temporal } = require("@js-temporal/polyfill");
|
||||||
const { UaqCalendar, FcnaCalendar, uaqCalendar, fcnaCalendar } = require('./dist/index.cjs');
|
const { UaqCalendar, FcnaCalendar, uaqCalendar, fcnaCalendar } = require("./dist/index.cjs");
|
||||||
|
|
||||||
const isoRamadan = Temporal.PlainDate.from('2023-03-23');
|
const isoRamadan = Temporal.PlainDate.from("2023-03-23");
|
||||||
|
|
||||||
// ── Class and singleton exports ───────────────────────────────────────────────
|
// ── Class and singleton exports ───────────────────────────────────────────────
|
||||||
|
|
||||||
describe('CJS class exports', () => {
|
describe("CJS class exports", () => {
|
||||||
it('UaqCalendar class loads via require', () => {
|
it("UaqCalendar class loads via require", () => {
|
||||||
assert(typeof UaqCalendar === 'function', 'UaqCalendar should be a constructor');
|
assert(typeof UaqCalendar === "function", "UaqCalendar should be a constructor");
|
||||||
const cal = new UaqCalendar();
|
const cal = new UaqCalendar();
|
||||||
assert.equal(cal.id, 'hijri-uaq');
|
assert.equal(cal.id, "hijri-uaq");
|
||||||
});
|
});
|
||||||
|
|
||||||
it('FcnaCalendar class loads via require', () => {
|
it("FcnaCalendar class loads via require", () => {
|
||||||
assert(typeof FcnaCalendar === 'function', 'FcnaCalendar should be a constructor');
|
assert(typeof FcnaCalendar === "function", "FcnaCalendar should be a constructor");
|
||||||
const cal = new FcnaCalendar();
|
const cal = new FcnaCalendar();
|
||||||
assert.equal(cal.id, 'hijri-fcna');
|
assert.equal(cal.id, "hijri-fcna");
|
||||||
});
|
});
|
||||||
|
|
||||||
it('uaqCalendar singleton id', () => {
|
it("uaqCalendar singleton id", () => {
|
||||||
assert.equal(uaqCalendar.id, 'hijri-uaq');
|
assert.equal(uaqCalendar.id, "hijri-uaq");
|
||||||
});
|
});
|
||||||
|
|
||||||
it('fcnaCalendar singleton id', () => {
|
it("fcnaCalendar singleton id", () => {
|
||||||
assert.equal(fcnaCalendar.id, 'hijri-fcna');
|
assert.equal(fcnaCalendar.id, "hijri-fcna");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// ── Field accessors ───────────────────────────────────────────────────────────
|
// ── Field accessors ───────────────────────────────────────────────────────────
|
||||||
|
|
||||||
describe('CJS field accessors', () => {
|
describe("CJS field accessors", () => {
|
||||||
it('uaqCalendar.year(2023-03-23) = 1444', () => {
|
it("uaqCalendar.year(2023-03-23) = 1444", () => {
|
||||||
assert.equal(uaqCalendar.year(isoRamadan), 1444);
|
assert.equal(uaqCalendar.year(isoRamadan), 1444);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('uaqCalendar.month(2023-03-23) = 9', () => {
|
it("uaqCalendar.month(2023-03-23) = 9", () => {
|
||||||
assert.equal(uaqCalendar.month(isoRamadan), 9);
|
assert.equal(uaqCalendar.month(isoRamadan), 9);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('uaqCalendar.day(2023-03-23) = 1', () => {
|
it("uaqCalendar.day(2023-03-23) = 1", () => {
|
||||||
assert.equal(uaqCalendar.day(isoRamadan), 1);
|
assert.equal(uaqCalendar.day(isoRamadan), 1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// ── dateFromFields ─────────────────────────────────────────────────────────────
|
// ── dateFromFields ─────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
describe('CJS dateFromFields', () => {
|
describe("CJS dateFromFields", () => {
|
||||||
it('uaqCalendar.dateFromFields({year:1444, month:9, day:1}) = 2023-03-23', () => {
|
it("uaqCalendar.dateFromFields({year:1444, month:9, day:1}) = 2023-03-23", () => {
|
||||||
const result = uaqCalendar.dateFromFields({ year: 1444, month: 9, day: 1 });
|
const result = uaqCalendar.dateFromFields({ year: 1444, month: 9, day: 1 });
|
||||||
assert.equal(result.toString(), '2023-03-23');
|
assert.equal(result.toString(), "2023-03-23");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// ── fields() ──────────────────────────────────────────────────────────────────
|
// ── fields() ──────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
describe('CJS fields()', () => {
|
describe("CJS fields()", () => {
|
||||||
it('returns the input array unchanged', () => {
|
it("returns the input array unchanged", () => {
|
||||||
assert.deepEqual(uaqCalendar.fields(['year', 'month', 'day']), ['year', 'month', 'day']);
|
assert.deepEqual(uaqCalendar.fields(["year", "month", "day"]), ["year", "month", "day"]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
162
test.mjs
162
test.mjs
|
|
@ -5,127 +5,127 @@
|
||||||
* Reference point: 2023-03-23 = 1 Ramadan 1444 AH (both UAQ and FCNA agree).
|
* Reference point: 2023-03-23 = 1 Ramadan 1444 AH (both UAQ and FCNA agree).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { describe, it } from 'node:test';
|
import { describe, it } from "node:test";
|
||||||
import assert from 'node:assert/strict';
|
import assert from "node:assert/strict";
|
||||||
import { Temporal } from '@js-temporal/polyfill';
|
import { Temporal } from "@js-temporal/polyfill";
|
||||||
import { UaqCalendar, FcnaCalendar, uaqCalendar, fcnaCalendar } from './dist/index.mjs';
|
import { UaqCalendar, FcnaCalendar, uaqCalendar, fcnaCalendar } from "./dist/index.mjs";
|
||||||
|
|
||||||
// Reference date: 2023-03-23 = 1 Ramadan 1444 AH
|
// Reference date: 2023-03-23 = 1 Ramadan 1444 AH
|
||||||
const isoRamadan = Temporal.PlainDate.from('2023-03-23');
|
const isoRamadan = Temporal.PlainDate.from("2023-03-23");
|
||||||
// 2023-04-21 = 1 Shawwal 1444 AH (first day after Ramadan)
|
// 2023-04-21 = 1 Shawwal 1444 AH (first day after Ramadan)
|
||||||
const isoShawwal = Temporal.PlainDate.from('2023-04-21');
|
const isoShawwal = Temporal.PlainDate.from("2023-04-21");
|
||||||
// 2021-08-09 = 1 Muharram 1443 AH (a 355-day / leap year)
|
// 2021-08-09 = 1 Muharram 1443 AH (a 355-day / leap year)
|
||||||
const isoLeapYear = Temporal.PlainDate.from('2021-08-09');
|
const isoLeapYear = Temporal.PlainDate.from("2021-08-09");
|
||||||
|
|
||||||
// ── 1. Class exports ──────────────────────────────────────────────────────────
|
// ── 1. Class exports ──────────────────────────────────────────────────────────
|
||||||
|
|
||||||
describe('Class exports', () => {
|
describe("Class exports", () => {
|
||||||
it('UaqCalendar class export', () => {
|
it("UaqCalendar class export", () => {
|
||||||
assert(UaqCalendar, 'UaqCalendar should be exported');
|
assert(UaqCalendar, "UaqCalendar should be exported");
|
||||||
const cal = new UaqCalendar();
|
const cal = new UaqCalendar();
|
||||||
assert(cal instanceof UaqCalendar, 'UaqCalendar should be instantiable');
|
assert(cal instanceof UaqCalendar, "UaqCalendar should be instantiable");
|
||||||
});
|
});
|
||||||
|
|
||||||
it('FcnaCalendar class export', () => {
|
it("FcnaCalendar class export", () => {
|
||||||
assert(FcnaCalendar, 'FcnaCalendar should be exported');
|
assert(FcnaCalendar, "FcnaCalendar should be exported");
|
||||||
const cal = new FcnaCalendar();
|
const cal = new FcnaCalendar();
|
||||||
assert(cal instanceof FcnaCalendar, 'FcnaCalendar should be instantiable');
|
assert(cal instanceof FcnaCalendar, "FcnaCalendar should be instantiable");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// ── 2. Calendar IDs ───────────────────────────────────────────────────────────
|
// ── 2. Calendar IDs ───────────────────────────────────────────────────────────
|
||||||
|
|
||||||
describe('Calendar IDs', () => {
|
describe("Calendar IDs", () => {
|
||||||
it('uaqCalendar.id', () => {
|
it("uaqCalendar.id", () => {
|
||||||
assert.equal(uaqCalendar.id, 'hijri-uaq');
|
assert.equal(uaqCalendar.id, "hijri-uaq");
|
||||||
});
|
});
|
||||||
|
|
||||||
it('fcnaCalendar.id', () => {
|
it("fcnaCalendar.id", () => {
|
||||||
assert.equal(fcnaCalendar.id, 'hijri-fcna');
|
assert.equal(fcnaCalendar.id, "hijri-fcna");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// ── 3. Field accessors on 1 Ramadan 1444 (2023-03-23) ────────────────────────
|
// ── 3. Field accessors on 1 Ramadan 1444 (2023-03-23) ────────────────────────
|
||||||
|
|
||||||
describe('Field accessors (UAQ, 1 Ramadan 1444)', () => {
|
describe("Field accessors (UAQ, 1 Ramadan 1444)", () => {
|
||||||
it('year = 1444', () => {
|
it("year = 1444", () => {
|
||||||
assert.equal(uaqCalendar.year(isoRamadan), 1444);
|
assert.equal(uaqCalendar.year(isoRamadan), 1444);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('month = 9 (Ramadan)', () => {
|
it("month = 9 (Ramadan)", () => {
|
||||||
assert.equal(uaqCalendar.month(isoRamadan), 9);
|
assert.equal(uaqCalendar.month(isoRamadan), 9);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('day = 1', () => {
|
it("day = 1", () => {
|
||||||
assert.equal(uaqCalendar.day(isoRamadan), 1);
|
assert.equal(uaqCalendar.day(isoRamadan), 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('monthCode = "M09"', () => {
|
it('monthCode = "M09"', () => {
|
||||||
assert.equal(uaqCalendar.monthCode(isoRamadan), 'M09');
|
assert.equal(uaqCalendar.monthCode(isoRamadan), "M09");
|
||||||
});
|
});
|
||||||
|
|
||||||
it('daysInMonth = 29 (Ramadan 1444)', () => {
|
it("daysInMonth = 29 (Ramadan 1444)", () => {
|
||||||
assert.equal(uaqCalendar.daysInMonth(isoRamadan), 29);
|
assert.equal(uaqCalendar.daysInMonth(isoRamadan), 29);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('monthsInYear = 12', () => {
|
it("monthsInYear = 12", () => {
|
||||||
assert.equal(uaqCalendar.monthsInYear(isoRamadan), 12);
|
assert.equal(uaqCalendar.monthsInYear(isoRamadan), 12);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('daysInWeek = 7', () => {
|
it("daysInWeek = 7", () => {
|
||||||
assert.equal(uaqCalendar.daysInWeek(isoRamadan), 7);
|
assert.equal(uaqCalendar.daysInWeek(isoRamadan), 7);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('dayOfWeek = 4 (Thursday)', () => {
|
it("dayOfWeek = 4 (Thursday)", () => {
|
||||||
assert.equal(uaqCalendar.dayOfWeek(isoRamadan), 4);
|
assert.equal(uaqCalendar.dayOfWeek(isoRamadan), 4);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('dayOfYear = 237', () => {
|
it("dayOfYear = 237", () => {
|
||||||
assert.equal(uaqCalendar.dayOfYear(isoRamadan), 237);
|
assert.equal(uaqCalendar.dayOfYear(isoRamadan), 237);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// ── 4. dateFromFields ─────────────────────────────────────────────────────────
|
// ── 4. dateFromFields ─────────────────────────────────────────────────────────
|
||||||
|
|
||||||
describe('dateFromFields', () => {
|
describe("dateFromFields", () => {
|
||||||
it('dateFromFields({year:1444, month:9, day:1}) = 2023-03-23', () => {
|
it("dateFromFields({year:1444, month:9, day:1}) = 2023-03-23", () => {
|
||||||
const result = uaqCalendar.dateFromFields({ year: 1444, month: 9, day: 1 });
|
const result = uaqCalendar.dateFromFields({ year: 1444, month: 9, day: 1 });
|
||||||
assert.equal(result.toString(), '2023-03-23');
|
assert.equal(result.toString(), "2023-03-23");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// ── 5. dateAdd ────────────────────────────────────────────────────────────────
|
// ── 5. dateAdd ────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
describe('dateAdd', () => {
|
describe("dateAdd", () => {
|
||||||
it('adding 1 month from 1 Ramadan 1444 lands on 1 Shawwal 1444', () => {
|
it("adding 1 month from 1 Ramadan 1444 lands on 1 Shawwal 1444", () => {
|
||||||
const oneMonth = new Temporal.Duration(0, 1, 0, 0);
|
const oneMonth = new Temporal.Duration(0, 1, 0, 0);
|
||||||
const result = uaqCalendar.dateAdd(isoRamadan, oneMonth);
|
const result = uaqCalendar.dateAdd(isoRamadan, oneMonth);
|
||||||
assert.equal(result.toString(), isoShawwal.toString());
|
assert.equal(result.toString(), isoShawwal.toString());
|
||||||
assert.equal(uaqCalendar.month(result), 10);
|
assert.equal(uaqCalendar.month(result), 10);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('adding 7 days from 1 Ramadan 1444', () => {
|
it("adding 7 days from 1 Ramadan 1444", () => {
|
||||||
const sevenDays = new Temporal.Duration(0, 0, 0, 7);
|
const sevenDays = new Temporal.Duration(0, 0, 0, 7);
|
||||||
const result = uaqCalendar.dateAdd(isoRamadan, sevenDays);
|
const result = uaqCalendar.dateAdd(isoRamadan, sevenDays);
|
||||||
assert.equal(uaqCalendar.day(result), 8);
|
assert.equal(uaqCalendar.day(result), 8);
|
||||||
assert.equal(uaqCalendar.month(result), 9);
|
assert.equal(uaqCalendar.month(result), 9);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('adding 1 week from 1 Ramadan 1444', () => {
|
it("adding 1 week from 1 Ramadan 1444", () => {
|
||||||
const oneWeek = new Temporal.Duration(0, 0, 1, 0);
|
const oneWeek = new Temporal.Duration(0, 0, 1, 0);
|
||||||
const result = uaqCalendar.dateAdd(isoRamadan, oneWeek);
|
const result = uaqCalendar.dateAdd(isoRamadan, oneWeek);
|
||||||
assert.equal(uaqCalendar.day(result), 8);
|
assert.equal(uaqCalendar.day(result), 8);
|
||||||
assert.equal(uaqCalendar.month(result), 9);
|
assert.equal(uaqCalendar.month(result), 9);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('adding 12 months rolls the year forward', () => {
|
it("adding 12 months rolls the year forward", () => {
|
||||||
const twelveMonths = new Temporal.Duration(0, 12, 0, 0);
|
const twelveMonths = new Temporal.Duration(0, 12, 0, 0);
|
||||||
const result = uaqCalendar.dateAdd(isoRamadan, twelveMonths);
|
const result = uaqCalendar.dateAdd(isoRamadan, twelveMonths);
|
||||||
assert.equal(uaqCalendar.year(result), 1445);
|
assert.equal(uaqCalendar.year(result), 1445);
|
||||||
assert.equal(uaqCalendar.month(result), 9);
|
assert.equal(uaqCalendar.month(result), 9);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('subtracting months via negative duration', () => {
|
it("subtracting months via negative duration", () => {
|
||||||
const negMonth = new Temporal.Duration(0, -1, 0, 0);
|
const negMonth = new Temporal.Duration(0, -1, 0, 0);
|
||||||
const result = uaqCalendar.dateAdd(isoShawwal, negMonth);
|
const result = uaqCalendar.dateAdd(isoShawwal, negMonth);
|
||||||
assert.equal(uaqCalendar.month(result), 9);
|
assert.equal(uaqCalendar.month(result), 9);
|
||||||
|
|
@ -135,29 +135,29 @@ describe('dateAdd', () => {
|
||||||
|
|
||||||
// ── 6. dateUntil ──────────────────────────────────────────────────────────────
|
// ── 6. dateUntil ──────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
describe('dateUntil', () => {
|
describe("dateUntil", () => {
|
||||||
it('days between 1 Ramadan and 1 Shawwal 1444', () => {
|
it("days between 1 Ramadan and 1 Shawwal 1444", () => {
|
||||||
const dur = uaqCalendar.dateUntil(isoRamadan, isoShawwal, { largestUnit: 'days' });
|
const dur = uaqCalendar.dateUntil(isoRamadan, isoShawwal, { largestUnit: "days" });
|
||||||
assert.equal(dur.days, 29);
|
assert.equal(dur.days, 29);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('months between 1 Ramadan and 1 Shawwal 1444', () => {
|
it("months between 1 Ramadan and 1 Shawwal 1444", () => {
|
||||||
const dur = uaqCalendar.dateUntil(isoRamadan, isoShawwal, { largestUnit: 'months' });
|
const dur = uaqCalendar.dateUntil(isoRamadan, isoShawwal, { largestUnit: "months" });
|
||||||
assert.equal(dur.months, 1);
|
assert.equal(dur.months, 1);
|
||||||
assert.equal(dur.days, 0);
|
assert.equal(dur.days, 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('years between dates spanning one Hijri year', () => {
|
it("years between dates spanning one Hijri year", () => {
|
||||||
const iso1443 = uaqCalendar.dateFromFields({ year: 1443, month: 1, day: 1 });
|
const iso1443 = uaqCalendar.dateFromFields({ year: 1443, month: 1, day: 1 });
|
||||||
const iso1444 = uaqCalendar.dateFromFields({ year: 1444, month: 1, day: 1 });
|
const iso1444 = uaqCalendar.dateFromFields({ year: 1444, month: 1, day: 1 });
|
||||||
const dur = uaqCalendar.dateUntil(iso1443, iso1444, { largestUnit: 'years' });
|
const dur = uaqCalendar.dateUntil(iso1443, iso1444, { largestUnit: "years" });
|
||||||
assert.equal(dur.years, 1);
|
assert.equal(dur.years, 1);
|
||||||
assert.equal(dur.months, 0);
|
assert.equal(dur.months, 0);
|
||||||
assert.equal(dur.days, 0);
|
assert.equal(dur.days, 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('weeks between dates', () => {
|
it("weeks between dates", () => {
|
||||||
const dur = uaqCalendar.dateUntil(isoRamadan, isoShawwal, { largestUnit: 'weeks' });
|
const dur = uaqCalendar.dateUntil(isoRamadan, isoShawwal, { largestUnit: "weeks" });
|
||||||
assert.equal(dur.weeks, 4);
|
assert.equal(dur.weeks, 4);
|
||||||
assert.equal(dur.days, 1);
|
assert.equal(dur.days, 1);
|
||||||
});
|
});
|
||||||
|
|
@ -165,8 +165,8 @@ describe('dateUntil', () => {
|
||||||
|
|
||||||
// ── 7. inLeapYear ─────────────────────────────────────────────────────────────
|
// ── 7. inLeapYear ─────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
describe('inLeapYear', () => {
|
describe("inLeapYear", () => {
|
||||||
it('1443 AH (355 days) is a leap year, 1444 AH (354) is not', () => {
|
it("1443 AH (355 days) is a leap year, 1444 AH (354) is not", () => {
|
||||||
assert.equal(uaqCalendar.inLeapYear(isoLeapYear), true);
|
assert.equal(uaqCalendar.inLeapYear(isoLeapYear), true);
|
||||||
assert.equal(uaqCalendar.inLeapYear(isoRamadan), false);
|
assert.equal(uaqCalendar.inLeapYear(isoRamadan), false);
|
||||||
});
|
});
|
||||||
|
|
@ -174,18 +174,18 @@ describe('inLeapYear', () => {
|
||||||
|
|
||||||
// ── 8. FCNA calendar ──────────────────────────────────────────────────────────
|
// ── 8. FCNA calendar ──────────────────────────────────────────────────────────
|
||||||
|
|
||||||
describe('FCNA calendar', () => {
|
describe("FCNA calendar", () => {
|
||||||
it('fcnaCalendar.year(2023-03-23) returns a valid Hijri year', () => {
|
it("fcnaCalendar.year(2023-03-23) returns a valid Hijri year", () => {
|
||||||
const year = fcnaCalendar.year(isoRamadan);
|
const year = fcnaCalendar.year(isoRamadan);
|
||||||
assert(typeof year === 'number' && year > 1400, `Expected a Hijri year > 1400, got ${year}`);
|
assert(typeof year === "number" && year > 1400, `Expected a Hijri year > 1400, got ${year}`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// ── 9. Out-of-range error ─────────────────────────────────────────────────────
|
// ── 9. Out-of-range error ─────────────────────────────────────────────────────
|
||||||
|
|
||||||
describe('Out-of-range error', () => {
|
describe("Out-of-range error", () => {
|
||||||
it('uaqCalendar.year throws RangeError for out-of-range date (1800-01-01)', () => {
|
it("uaqCalendar.year throws RangeError for out-of-range date (1800-01-01)", () => {
|
||||||
const outOfRange = Temporal.PlainDate.from('1800-01-01');
|
const outOfRange = Temporal.PlainDate.from("1800-01-01");
|
||||||
assert.throws(
|
assert.throws(
|
||||||
() => uaqCalendar.year(outOfRange),
|
() => uaqCalendar.year(outOfRange),
|
||||||
(err) => err instanceof RangeError,
|
(err) => err instanceof RangeError,
|
||||||
|
|
@ -195,11 +195,11 @@ describe('Out-of-range error', () => {
|
||||||
|
|
||||||
// ── 10. overflow option ───────────────────────────────────────────────────────
|
// ── 10. overflow option ───────────────────────────────────────────────────────
|
||||||
|
|
||||||
describe('overflow option', () => {
|
describe("overflow option", () => {
|
||||||
it('dateFromFields with overflow: "constrain" clamps day', () => {
|
it('dateFromFields with overflow: "constrain" clamps day', () => {
|
||||||
const result = uaqCalendar.dateFromFields(
|
const result = uaqCalendar.dateFromFields(
|
||||||
{ year: 1444, month: 9, day: 31 },
|
{ year: 1444, month: 9, day: 31 },
|
||||||
{ overflow: 'constrain' },
|
{ overflow: "constrain" },
|
||||||
);
|
);
|
||||||
assert.equal(uaqCalendar.day(result), 29);
|
assert.equal(uaqCalendar.day(result), 29);
|
||||||
assert.equal(uaqCalendar.month(result), 9);
|
assert.equal(uaqCalendar.month(result), 9);
|
||||||
|
|
@ -207,19 +207,19 @@ describe('overflow option', () => {
|
||||||
|
|
||||||
it('dateFromFields with overflow: "reject" throws RangeError', () => {
|
it('dateFromFields with overflow: "reject" throws RangeError', () => {
|
||||||
assert.throws(
|
assert.throws(
|
||||||
() => uaqCalendar.dateFromFields({ year: 1444, month: 9, day: 31 }, { overflow: 'reject' }),
|
() => uaqCalendar.dateFromFields({ year: 1444, month: 9, day: 31 }, { overflow: "reject" }),
|
||||||
(err) => err instanceof RangeError,
|
(err) => err instanceof RangeError,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('monthDayFromFields with overflow: "constrain" clamps day', () => {
|
it('monthDayFromFields with overflow: "constrain" clamps day', () => {
|
||||||
const result = uaqCalendar.monthDayFromFields({ month: 9, day: 31 }, { overflow: 'constrain' });
|
const result = uaqCalendar.monthDayFromFields({ month: 9, day: 31 }, { overflow: "constrain" });
|
||||||
assert.ok(result);
|
assert.ok(result);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('monthDayFromFields with overflow: "reject" throws RangeError', () => {
|
it('monthDayFromFields with overflow: "reject" throws RangeError', () => {
|
||||||
assert.throws(
|
assert.throws(
|
||||||
() => uaqCalendar.monthDayFromFields({ month: 9, day: 31 }, { overflow: 'reject' }),
|
() => uaqCalendar.monthDayFromFields({ month: 9, day: 31 }, { overflow: "reject" }),
|
||||||
(err) => err instanceof RangeError,
|
(err) => err instanceof RangeError,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
@ -227,22 +227,22 @@ describe('overflow option', () => {
|
||||||
|
|
||||||
// ── 11. fields() ──────────────────────────────────────────────────────────────
|
// ── 11. fields() ──────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
describe('fields()', () => {
|
describe("fields()", () => {
|
||||||
it('returns the input array unchanged', () => {
|
it("returns the input array unchanged", () => {
|
||||||
const input = ['year', 'month', 'day'];
|
const input = ["year", "month", "day"];
|
||||||
const result = uaqCalendar.fields(input);
|
const result = uaqCalendar.fields(input);
|
||||||
assert.deepEqual(result, ['year', 'month', 'day']);
|
assert.deepEqual(result, ["year", "month", "day"]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('returns an empty array for empty input', () => {
|
it("returns an empty array for empty input", () => {
|
||||||
assert.deepEqual(uaqCalendar.fields([]), []);
|
assert.deepEqual(uaqCalendar.fields([]), []);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// ── 12. yearMonthFromFields ─────────────────────────────────────────────────
|
// ── 12. yearMonthFromFields ─────────────────────────────────────────────────
|
||||||
|
|
||||||
describe('yearMonthFromFields', () => {
|
describe("yearMonthFromFields", () => {
|
||||||
it('creates a PlainYearMonth for Ramadan 1444', () => {
|
it("creates a PlainYearMonth for Ramadan 1444", () => {
|
||||||
const result = uaqCalendar.yearMonthFromFields({ year: 1444, month: 9 });
|
const result = uaqCalendar.yearMonthFromFields({ year: 1444, month: 9 });
|
||||||
assert.ok(result);
|
assert.ok(result);
|
||||||
assert.equal(result.month, 3);
|
assert.equal(result.month, 3);
|
||||||
|
|
@ -252,14 +252,36 @@ describe('yearMonthFromFields', () => {
|
||||||
|
|
||||||
// ── 13. monthDayFromFields ──────────────────────────────────────────────────
|
// ── 13. monthDayFromFields ──────────────────────────────────────────────────
|
||||||
|
|
||||||
describe('monthDayFromFields', () => {
|
describe("monthDayFromFields", () => {
|
||||||
it('creates a PlainMonthDay for 15 Ramadan (default reference year)', () => {
|
it("creates a PlainMonthDay for 15 Ramadan (default reference year)", () => {
|
||||||
const result = uaqCalendar.monthDayFromFields({ month: 9, day: 15 });
|
const result = uaqCalendar.monthDayFromFields({ month: 9, day: 15 });
|
||||||
assert.ok(result);
|
assert.ok(result);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('creates a PlainMonthDay with explicit year', () => {
|
it("creates a PlainMonthDay with explicit year", () => {
|
||||||
const result = uaqCalendar.monthDayFromFields({ month: 9, day: 1, year: 1445 });
|
const result = uaqCalendar.monthDayFromFields({ month: 9, day: 1, year: 1445 });
|
||||||
assert.ok(result);
|
assert.ok(result);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// ── 14. UTC-day round-trip regression ─────────────────────────────────────────
|
||||||
|
// Verifies that ISO→Hijri→ISO is exact regardless of host timezone.
|
||||||
|
// 2025-03-01 = 1 Ramadan 1446 AH (UAQ).
|
||||||
|
|
||||||
|
describe("UTC-day round-trip regression (ISO → Hijri → ISO)", () => {
|
||||||
|
const isoRamadan1446 = Temporal.PlainDate.from("2025-03-01");
|
||||||
|
|
||||||
|
it("2025-03-01 maps to 1 Ramadan 1446 AH", () => {
|
||||||
|
assert.equal(uaqCalendar.year(isoRamadan1446), 1446);
|
||||||
|
assert.equal(uaqCalendar.month(isoRamadan1446), 9);
|
||||||
|
assert.equal(uaqCalendar.day(isoRamadan1446), 1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("round-trip: 1446-09-01 → ISO → Hijri returns 1446-09-01", () => {
|
||||||
|
const iso = uaqCalendar.dateFromFields({ year: 1446, month: 9, day: 1 });
|
||||||
|
assert.equal(iso.toString(), "2025-03-01");
|
||||||
|
assert.equal(uaqCalendar.year(iso), 1446);
|
||||||
|
assert.equal(uaqCalendar.month(iso), 9);
|
||||||
|
assert.equal(uaqCalendar.day(iso), 1);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,17 @@
|
||||||
import { defineConfig } from 'tsup';
|
import { defineConfig } from "tsup";
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
entry: ['src/index.ts'],
|
entry: ["src/index.ts"],
|
||||||
format: ['cjs', 'esm'],
|
format: ["cjs", "esm"],
|
||||||
dts: true,
|
dts: true,
|
||||||
clean: true,
|
clean: true,
|
||||||
outDir: 'dist',
|
outDir: "dist",
|
||||||
splitting: false,
|
splitting: false,
|
||||||
sourcemap: true,
|
sourcemap: true,
|
||||||
target: 'es2020',
|
target: "es2020",
|
||||||
platform: 'node',
|
platform: "node",
|
||||||
external: ['hijri-core', '@js-temporal/polyfill'],
|
external: ["hijri-core", "@js-temporal/polyfill"],
|
||||||
outExtension({ format }) {
|
outExtension({ format }) {
|
||||||
return { js: format === 'esm' ? '.mjs' : '.cjs' };
|
return { js: format === "esm" ? ".mjs" : ".cjs" };
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue