@remotemerge/nepali-date-converter 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Madan Sapkota
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,184 @@
1
+ # 📅 Nepali Date Converter
2
+
3
+ [![Package](https://img.shields.io/npm/v/@remotemerge/nepali-date-converter?logo=npm)](https://www.npmjs.com/package/@remotemerge/nepali-date-converter)
4
+ [![Build](https://img.shields.io/github/workflow/status/remotemerge/nepali-date-converter/Publish?logo=github)](README.md)
5
+ [![Downloads](https://img.shields.io/npm/dt/@remotemerge/nepali-date-converter?logo=spreadshirt)](https://www.npmjs.com/package/@remotemerge/nepali-date-converter)
6
+ [![Size](https://img.shields.io/bundlephobia/minzip/@remotemerge/nepali-date-converter?logo=ipfs)](https://bundlephobia.com/result?p=@remotemerge/nepali-date-converter)
7
+ [![License](https://img.shields.io/npm/l/@remotemerge/nepali-date-converter?logo=opensourceinitiative)](LICENSE)
8
+
9
+ **Nepali Date Converter** is a lightweight, high-performance JavaScript library designed to simplify date conversions between the **Bikram Sambat (BS)** and **Gregorian (AD)** calendars. Whether you're building applications for Nepali users or working with historical data, NDC provides accurate and efficient date conversion for **1975 BS to 2099 BS** (1918 AD to 2043 AD). Perfect for developers working with Nepali calendars, festivals, or events.
10
+
11
+ ---
12
+
13
+ ## ✨ Features
14
+
15
+ - **Accurate Date Conversion**: Convert dates between **BS (Bikram Sambat)** and **AD (Gregorian)** with 100% accuracy.
16
+ - **Wide Date Range**: Supports conversion for **1975 BS to 2099 BS** (1918 AD to 2043 AD).
17
+ - **Lightweight**: Just **7.3 KB** (plain) and **2.2 KB** (gzipped) — optimized for performance.
18
+ - **TypeScript Support**: Built-in TypeScript types for a seamless development experience.
19
+ - **Cross-Platform**: Works in **Node.js**, **browsers**, and bundlers like **Webpack**, **Rollup**, **Vite**, etc.
20
+ - **Fast and Reliable**: Localized data and optimized code for lightning-fast results.
21
+
22
+ ---
23
+
24
+ ## 🚀 Installation
25
+
26
+ Install the package via **npm** or **Yarn**:
27
+
28
+ ```bash
29
+ npm install @remotemerge/nepali-date-converter
30
+ ```
31
+
32
+ or
33
+
34
+ ```bash
35
+ yarn add @remotemerge/nepali-date-converter
36
+ ```
37
+
38
+ ---
39
+
40
+ ## 📖 Quick Start
41
+ To get started with the Nepali Date Converter, follow the simple examples below. You can convert dates from **BS to AD** or **AD to BS** with just a few lines of code.
42
+
43
+ ### Importing the Library
44
+
45
+ #### ES Modules (Recommended for Modern JavaScript/TypeScript Projects)
46
+ ```javascript
47
+ import DateConverter from '@remotemerge/nepali-date-converter';
48
+ ```
49
+
50
+ #### CommonJS (For Node.js or Legacy Projects)
51
+ ```javascript
52
+ const DateConverter = require('@remotemerge/nepali-date-converter');
53
+ ```
54
+
55
+ ---
56
+
57
+ ### Converting BS to AD
58
+
59
+ Convert a **Bikram Sambat (BS)** date to a **Gregorian (AD)** date. Simply pass the BS date in `YYYY-MM-DD` format to the `DateConverter` and call the `.toAd()` method.
60
+
61
+ ```javascript
62
+ // Convert BS date '2079-10-17' to AD
63
+ const converted = new DateConverter('2079-10-17').toAd();
64
+ console.log(converted);
65
+ ```
66
+
67
+ **Output**:
68
+ ```text
69
+ { year: 2023, month: 1, date: 30, day: 'Monday' }
70
+ ```
71
+
72
+ - **Input Format**: `YYYY-MM-DD` (Bikram Sambat date).
73
+ - **Output**: An object containing the converted Gregorian date (`year`, `month`, `date`) and the day of the week (`day`).
74
+
75
+ ---
76
+
77
+ ### Converting AD to BS
78
+
79
+ Convert a **Gregorian (AD)** date to a **Bikram Sambat (BS)** date. Pass the AD date in `YYYY-MM-DD` format to the `DateConverter` and call the `.toBs()` method.
80
+
81
+ ```javascript
82
+ // Convert AD date '2023-01-30' to BS
83
+ const converted = new DateConverter('2023-01-30').toBs();
84
+ console.log(converted);
85
+ ```
86
+
87
+ **Output**:
88
+ ```text
89
+ { year: 2079, month: 10, date: 17, day: 'Monday' }
90
+ ```
91
+
92
+ - **Input Format**: `YYYY-MM-DD` (Gregorian date).
93
+ - **Output**: An object containing the converted Bikram Sambat date (`year`, `month`, `date`) and the day of the week (`day`).
94
+
95
+ ---
96
+
97
+ ### Using the Library in the Browser (CDN)
98
+
99
+ You can also use the library directly in your HTML files via **jsDelivr CDN**. This is ideal for quick prototyping or projects without a build system.
100
+
101
+ ```html
102
+ <script src="https://cdn.jsdelivr.net/npm/@remotemerge/nepali-date-converter@1/dist/ndc-browser.js"></script>
103
+ <script>
104
+ // Convert BS date '2079-10-17' to AD
105
+ const converted = new DateConverter('2079-10-17').toAd();
106
+ console.log(converted);
107
+ </script>
108
+ ```
109
+
110
+ ---
111
+
112
+ ### Example Use Cases
113
+
114
+ 1. **Event Planning**: Convert Nepali festival dates to Gregorian dates for international users.
115
+ 2. **Historical Data**: Work with historical records that use the Bikram Sambat calendar.
116
+ 3. **Localization**: Display dates in the Nepali calendar for Nepali-speaking users.
117
+
118
+ ---
119
+
120
+ ### Advanced Usage
121
+
122
+ #### Handling Invalid Dates
123
+ If an invalid date is provided, the library will throw an error. Always ensure the input date is within the supported range (**1975 BS to 2099 BS** or **1918 AD to 2043 AD**).
124
+
125
+ ```javascript
126
+ try {
127
+ const converted = new DateConverter('2100-01-01').toAd(); // Invalid date
128
+ } catch (error) {
129
+ console.error(error.message); // "The input date is out of supported range."
130
+ }
131
+ ```
132
+
133
+ #### Working with TypeScript
134
+ The library includes built-in TypeScript support, so you get full type checking and autocompletion in your editor.
135
+
136
+ ```typescript
137
+ import DateConverter from '@remotemerge/nepali-date-converter';
138
+
139
+ const converted = new DateConverter('2079-10-17').toAd();
140
+ console.log(converted.year); // TypeScript knows this is a number
141
+ ```
142
+
143
+ ---
144
+
145
+ ## 📊 Why Use Nepali Date Converter?
146
+
147
+ - **Production-Ready**: Tested and verified for 100% accuracy across the supported date range.
148
+ - **Developer-Friendly**: Simple API, TypeScript support, and detailed documentation.
149
+ - **Lightweight**: Minimal bundle size for fast loading and performance.
150
+ - **Open Source**: MIT licensed — free to use, modify, and distribute.
151
+
152
+ ---
153
+
154
+ ## 🔧 API Reference
155
+
156
+ ### `DateConverter(date: string)`
157
+
158
+ - **`date`**: A string in `YYYY-MM-DD` format (either BS or AD).
159
+
160
+ ### Methods
161
+
162
+ - **`.toAd()`**: Converts a BS date to an AD date.
163
+ - Returns: `{ year: number, month: number, date: number, day: string }`
164
+
165
+ - **`.toBs()`**: Converts an AD date to a BS date.
166
+ - Returns: `{ year: number, month: number, date: number, day: string }`
167
+
168
+ ---
169
+
170
+ ## 📜 License
171
+
172
+ This project is licensed under the **MIT License**. See the [LICENSE](LICENSE) file for details.
173
+
174
+ ---
175
+
176
+ ## 🙌 Contributing
177
+
178
+ Contributions are welcome! If you find a bug or have a feature request, please open an issue on the [GitHub repository](https://github.com/remotemerge/nepali-date-converter).
179
+
180
+ ---
181
+
182
+ ## 📄 Documentation
183
+
184
+ For detailed documentation and advanced usage, visit the [GitHub repository](https://github.com/remotemerge/nepali-date-converter).
package/index.d.ts ADDED
@@ -0,0 +1,26 @@
1
+ export default class DateConverter {
2
+ private readonly startDate;
3
+ private readonly endDate;
4
+ private readonly dateRangeError;
5
+ private readonly inputYear;
6
+ private readonly inputMonth;
7
+ private readonly inputDate;
8
+ constructor(strDate: string);
9
+ private parseDateString;
10
+ private numToEn;
11
+ private numToDay;
12
+ private getAdDate;
13
+ private getBsDate;
14
+ toAd(): {
15
+ year: number;
16
+ month: number;
17
+ date: number;
18
+ day: string;
19
+ };
20
+ toBs(): {
21
+ day: string;
22
+ year: number;
23
+ month: number;
24
+ date: number;
25
+ };
26
+ }
package/ndc-browser.js ADDED
@@ -0,0 +1,2 @@
1
+ var DateConverter=function(){"use strict";var S=Object.defineProperty;var E=(h,i,c)=>i in h?S(h,i,{enumerable:!0,configurable:!0,writable:!0,value:c}):h[i]=c;var d=(h,i,c)=>E(h,typeof i!="symbol"?i+"":i,c);const i=Symbol.for("constructDateFrom");function c(r,e){return typeof r=="function"?r(e):r&&typeof r=="object"&&i in r?r[i](e):r instanceof Date?new r.constructor(e):new Date(e)}function D(r,e){return c(r,r)}function m(r,e,n){const a=D(r);return isNaN(e)?c(r,NaN):(e&&a.setDate(a.getDate()+e),a)}function l(r){const e=D(r),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+r-+n}function g(r,...e){const n=c.bind(null,e.find(a=>typeof a=="object"));return e.map(n)}function f(r,e){const n=D(r);return n.setHours(0,0,0,0),n}function p(r,e,n){const[a,o]=g(n==null?void 0:n.in,r,e),s=f(a),u=f(o),y=+s-l(s),Y=+u-l(u);return Math.round((y-Y)/864e5)}function w(r,e){const n=D(r);return n.setHours(23,59,59,999),n}function T(r,e,n){const a=+D(r),[o,s]=[+D(e.start),+D(e.end)].sort((u,y)=>u-y);return a>=o&&a<=s}const t=[];t[1975]=[31,31,32,32,31,30,30,29,30,29,30,30,365],t[1976]=[31,32,31,32,31,30,30,30,29,29,30,31,366],t[1977]=[30,32,31,32,31,31,29,30,30,29,29,31,365],t[1978]=[31,31,32,31,31,31,30,29,30,29,30,30,365],t[1979]=t[1975],t[1980]=t[1976],t[1981]=[31,31,31,32,31,31,29,30,30,29,29,31,365],t[1982]=t[1978],t[1983]=t[1975],t[1984]=t[1976],t[1985]=[31,31,31,32,31,31,29,30,30,29,30,30,365],t[1986]=t[1978],t[1987]=[31,32,31,32,31,30,30,29,30,29,30,30,365],t[1988]=t[1976],t[1989]=[31,31,31,32,31,31,30,29,30,29,30,30,365],t[1990]=t[1978],t[1991]=[31,32,31,32,31,30,30,30,29,29,30,30,365],t[1992]=[31,32,31,32,31,30,30,30,29,30,29,31,366],t[1993]=t[1989],t[1994]=t[1978],t[1995]=t[1991],t[1996]=t[1992],t[1997]=t[1978],t[1998]=[31,31,32,31,32,30,30,29,30,29,30,30,365],t[1999]=t[1976],t[2e3]=[30,32,31,32,31,30,30,30,29,30,29,31,365],t[2001]=t[1978],t[2002]=t[1975],t[2003]=t[1976],t[2004]=t[2e3],t[2005]=t[1978],t[2006]=t[1975],t[2007]=t[1976],t[2008]=t[1981],t[2009]=t[1978],t[2010]=t[1975],t[2011]=t[1976],t[2012]=t[1985],t[2013]=t[1978],t[2014]=t[1975],t[2015]=t[1976],t[2016]=t[1985],t[2017]=t[1978],t[2018]=t[1987],t[2019]=t[1992],t[2020]=t[1989],t[2021]=t[1978],t[2022]=t[1991],t[2023]=t[1992],t[2024]=t[1989],t[2025]=t[1978],t[2026]=t[1976],t[2027]=t[2e3],t[2028]=t[1978],t[2029]=t[1998],t[2030]=t[1976],t[2031]=t[2e3],t[2032]=t[1978],t[2033]=t[1975],t[2034]=t[1976],t[2035]=t[1977],t[2036]=t[1978],t[2037]=t[1975],t[2038]=t[1976],t[2039]=t[1985],t[2040]=t[1978],t[2041]=t[1975],t[2042]=t[1976],t[2043]=t[1985],t[2044]=t[1978],t[2045]=t[1987],t[2046]=t[1976],t[2047]=t[1989],t[2048]=t[1978],t[2049]=t[1991],t[2050]=t[1992],t[2051]=t[1989],t[2052]=t[1978],t[2053]=t[1991],t[2054]=t[1992],t[2055]=t[1978],t[2056]=t[1998],t[2057]=t[1976],t[2058]=t[2e3],t[2059]=t[1978],t[2060]=t[1975],t[2061]=t[1976],t[2062]=[30,32,31,32,31,31,29,30,29,30,29,31,365],t[2063]=t[1978],t[2064]=t[1975],t[2065]=t[1976],t[2066]=t[1981],t[2067]=t[1978],t[2068]=t[1975],t[2069]=t[1976],t[2070]=t[1985],t[2071]=t[1978],t[2072]=t[1987],t[2073]=t[1976],t[2074]=t[1989],t[2075]=t[1978],t[2076]=t[1991],t[2077]=t[1992],t[2078]=t[1989],t[2079]=t[1978],t[2080]=t[1991],t[2081]=t[1992],t[2082]=t[1989],t[2083]=t[1978],t[2084]=t[1976],t[2085]=t[2e3],t[2086]=t[1978],t[2087]=t[1975],t[2088]=t[1976],t[2089]=t[2e3],t[2090]=t[1978],t[2091]=t[1975],t[2092]=t[1976],t[2093]=t[1981],t[2094]=t[1978],t[2095]=t[1975],t[2096]=t[1976],t[2097]=t[1985],t[2098]=t[1978],t[2099]=t[1975];class M{constructor(e){d(this,"startDate",new Date("1918-04-13"));d(this,"endDate",new Date("2043-04-13"));d(this,"dateRangeError","The input date is out of supported range.");d(this,"inputYear");d(this,"inputMonth");d(this,"inputDate");const[n,a,o]=this.parseDateString(e);this.inputYear=n,this.inputMonth=a,this.inputDate=o}parseDateString(e){const n=this.numToEn(e).replace(/[./|,]/g,"-").trim(),[a,o,s]=n.split("-").map(Number);return[a,o,s]}numToEn(e){const n=["०","१","२","३","४","५","६","७","८","९"];return e.replace(/[०१२३४५६७८९]/g,a=>n.indexOf(a).toString())}numToDay(e){return["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][e]}getAdDate(e,n,a){let o=0;for(let s=1975;s<e;s++)o+=t[s][12];for(let s=0;s<n-1;s++)o+=t[e][s];return o+=a-1,m(this.startDate,o)}getBsDate(e){const n=new Date(e);let a=p(n,this.startDate);for(const o in t){const s=t[o][12];if(a>=s){a-=s;continue}for(let u=0;u<12;u++){const y=t[o][u];if(a>=y){a-=y;continue}return{year:Number(o),month:u+1,date:a+1}}}throw new Error(this.dateRangeError)}toAd(){if(this.inputYear<1975||this.inputYear>2099)throw new Error(this.dateRangeError);const e=this.getAdDate(this.inputYear,this.inputMonth,this.inputDate),n=this.numToDay(e.getDay());return{year:e.getFullYear(),month:e.getMonth()+1,date:e.getDate(),day:n}}toBs(){const e=`${this.inputYear}-${this.inputMonth}-${this.inputDate}`,n=new Date(e);if(!T(n,{start:f(this.startDate),end:w(this.endDate)}))throw new Error(this.dateRangeError);const a=this.getBsDate(e),o=this.numToDay(n.getDay());return{...a,day:o}}}return M}();
2
+ //# sourceMappingURL=ndc-browser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ndc-browser.js","sources":["../node_modules/date-fns/constants.js","../node_modules/date-fns/constructFrom.js","../node_modules/date-fns/toDate.js","../node_modules/date-fns/addDays.js","../node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js","../node_modules/date-fns/_lib/normalizeDates.js","../node_modules/date-fns/startOfDay.js","../node_modules/date-fns/differenceInCalendarDays.js","../node_modules/date-fns/endOfDay.js","../node_modules/date-fns/isWithinInterval.js","../src/years.ts","../src/index.ts"],"sourcesContent":["/**\n * @module constants\n * @summary Useful constants\n * @description\n * Collection of useful date constants.\n *\n * The constants could be imported from `date-fns/constants`:\n *\n * ```ts\n * import { maxTime, minTime } from \"./constants/date-fns/constants\";\n *\n * function isAllowedTime(time) {\n * return time <= maxTime && time >= minTime;\n * }\n * ```\n */\n\n/**\n * @constant\n * @name daysInWeek\n * @summary Days in 1 week.\n */\nexport const daysInWeek = 7;\n\n/**\n * @constant\n * @name daysInYear\n * @summary Days in 1 year.\n *\n * @description\n * How many days in a year.\n *\n * One years equals 365.2425 days according to the formula:\n *\n * > Leap year occurs every 4 years, except for years that are divisible by 100 and not divisible by 400.\n * > 1 mean year = (365+1/4-1/100+1/400) days = 365.2425 days\n */\nexport const daysInYear = 365.2425;\n\n/**\n * @constant\n * @name maxTime\n * @summary Maximum allowed time.\n *\n * @example\n * import { maxTime } from \"./constants/date-fns/constants\";\n *\n * const isValid = 8640000000000001 <= maxTime;\n * //=> false\n *\n * new Date(8640000000000001);\n * //=> Invalid Date\n */\nexport const maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1000;\n\n/**\n * @constant\n * @name minTime\n * @summary Minimum allowed time.\n *\n * @example\n * import { minTime } from \"./constants/date-fns/constants\";\n *\n * const isValid = -8640000000000001 >= minTime;\n * //=> false\n *\n * new Date(-8640000000000001)\n * //=> Invalid Date\n */\nexport const minTime = -maxTime;\n\n/**\n * @constant\n * @name millisecondsInWeek\n * @summary Milliseconds in 1 week.\n */\nexport const millisecondsInWeek = 604800000;\n\n/**\n * @constant\n * @name millisecondsInDay\n * @summary Milliseconds in 1 day.\n */\nexport const millisecondsInDay = 86400000;\n\n/**\n * @constant\n * @name millisecondsInMinute\n * @summary Milliseconds in 1 minute\n */\nexport const millisecondsInMinute = 60000;\n\n/**\n * @constant\n * @name millisecondsInHour\n * @summary Milliseconds in 1 hour\n */\nexport const millisecondsInHour = 3600000;\n\n/**\n * @constant\n * @name millisecondsInSecond\n * @summary Milliseconds in 1 second\n */\nexport const millisecondsInSecond = 1000;\n\n/**\n * @constant\n * @name minutesInYear\n * @summary Minutes in 1 year.\n */\nexport const minutesInYear = 525600;\n\n/**\n * @constant\n * @name minutesInMonth\n * @summary Minutes in 1 month.\n */\nexport const minutesInMonth = 43200;\n\n/**\n * @constant\n * @name minutesInDay\n * @summary Minutes in 1 day.\n */\nexport const minutesInDay = 1440;\n\n/**\n * @constant\n * @name minutesInHour\n * @summary Minutes in 1 hour.\n */\nexport const minutesInHour = 60;\n\n/**\n * @constant\n * @name monthsInQuarter\n * @summary Months in 1 quarter.\n */\nexport const monthsInQuarter = 3;\n\n/**\n * @constant\n * @name monthsInYear\n * @summary Months in 1 year.\n */\nexport const monthsInYear = 12;\n\n/**\n * @constant\n * @name quartersInYear\n * @summary Quarters in 1 year\n */\nexport const quartersInYear = 4;\n\n/**\n * @constant\n * @name secondsInHour\n * @summary Seconds in 1 hour.\n */\nexport const secondsInHour = 3600;\n\n/**\n * @constant\n * @name secondsInMinute\n * @summary Seconds in 1 minute.\n */\nexport const secondsInMinute = 60;\n\n/**\n * @constant\n * @name secondsInDay\n * @summary Seconds in 1 day.\n */\nexport const secondsInDay = secondsInHour * 24;\n\n/**\n * @constant\n * @name secondsInWeek\n * @summary Seconds in 1 week.\n */\nexport const secondsInWeek = secondsInDay * 7;\n\n/**\n * @constant\n * @name secondsInYear\n * @summary Seconds in 1 year.\n */\nexport const secondsInYear = secondsInDay * daysInYear;\n\n/**\n * @constant\n * @name secondsInMonth\n * @summary Seconds in 1 month\n */\nexport const secondsInMonth = secondsInYear / 12;\n\n/**\n * @constant\n * @name secondsInQuarter\n * @summary Seconds in 1 quarter.\n */\nexport const secondsInQuarter = secondsInMonth * 3;\n\n/**\n * @constant\n * @name constructFromSymbol\n * @summary Symbol enabling Date extensions to inherit properties from the reference date.\n *\n * The symbol is used to enable the `constructFrom` function to construct a date\n * using a reference date and a value. It allows to transfer extra properties\n * from the reference date to the new date. It's useful for extensions like\n * [`TZDate`](https://github.com/date-fns/tz) that accept a time zone as\n * a constructor argument.\n */\nexport const constructFromSymbol = Symbol.for(\"constructDateFrom\");\n","import { constructFromSymbol } from \"./constants.js\";\n\n/**\n * @name constructFrom\n * @category Generic Helpers\n * @summary Constructs a date using the reference date and the value\n *\n * @description\n * The function constructs a new date using the constructor from the reference\n * date and the given value. It helps to build generic functions that accept\n * date extensions.\n *\n * It defaults to `Date` if the passed reference date is a number or a string.\n *\n * Starting from v3.7.0, it allows to construct a date using `[Symbol.for(\"constructDateFrom\")]`\n * enabling to transfer extra properties from the reference date to the new date.\n * It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz)\n * that accept a time zone as a constructor argument.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n *\n * @param date - The reference date to take constructor from\n * @param value - The value to create the date\n *\n * @returns Date initialized using the given date and value\n *\n * @example\n * import { constructFrom } from \"./constructFrom/date-fns\";\n *\n * // A function that clones a date preserving the original type\n * function cloneDate<DateType extends Date>(date: DateType): DateType {\n * return constructFrom(\n * date, // Use constructor from the given date\n * date.getTime() // Use the date value to create a new date\n * );\n * }\n */\nexport function constructFrom(date, value) {\n if (typeof date === \"function\") return date(value);\n\n if (date && typeof date === \"object\" && constructFromSymbol in date)\n return date[constructFromSymbol](value);\n\n if (date instanceof Date) return new date.constructor(value);\n\n return new Date(value);\n}\n\n// Fallback for modularized imports:\nexport default constructFrom;\n","import { constructFrom } from \"./constructFrom.js\";\n\n/**\n * @name toDate\n * @category Common Helpers\n * @summary Convert the given argument to an instance of Date.\n *\n * @description\n * Convert the given argument to an instance of Date.\n *\n * If the argument is an instance of Date, the function returns its clone.\n *\n * If the argument is a number, it is treated as a timestamp.\n *\n * If the argument is none of the above, the function returns Invalid Date.\n *\n * Starting from v3.7.0, it clones a date using `[Symbol.for(\"constructDateFrom\")]`\n * enabling to transfer extra properties from the reference date to the new date.\n * It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz)\n * that accept a time zone as a constructor argument.\n *\n * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param argument - The value to convert\n *\n * @returns The parsed date in the local time zone\n *\n * @example\n * // Clone the date:\n * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))\n * //=> Tue Feb 11 2014 11:30:30\n *\n * @example\n * // Convert the timestamp to date:\n * const result = toDate(1392098430000)\n * //=> Tue Feb 11 2014 11:30:30\n */\nexport function toDate(argument, context) {\n // [TODO] Get rid of `toDate` or `constructFrom`?\n return constructFrom(context || argument, argument);\n}\n\n// Fallback for modularized imports:\nexport default toDate;\n","import { constructFrom } from \"./constructFrom.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link addDays} function options.\n */\n\n/**\n * @name addDays\n * @category Day Helpers\n * @summary Add the specified number of days to the given date.\n *\n * @description\n * Add the specified number of days to the given date.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The date to be changed\n * @param amount - The amount of days to be added.\n * @param options - An object with options\n *\n * @returns The new date with the days added\n *\n * @example\n * // Add 10 days to 1 September 2014:\n * const result = addDays(new Date(2014, 8, 1), 10)\n * //=> Thu Sep 11 2014 00:00:00\n */\nexport function addDays(date, amount, options) {\n const _date = toDate(date, options?.in);\n if (isNaN(amount)) return constructFrom(options?.in || date, NaN);\n\n // If 0 days, no-op to avoid changing times in the hour before end of DST\n if (!amount) return _date;\n\n _date.setDate(_date.getDate() + amount);\n return _date;\n}\n\n// Fallback for modularized imports:\nexport default addDays;\n","import { toDate } from \"../toDate.js\";\n\n/**\n * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.\n * They usually appear for dates that denote time before the timezones were introduced\n * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891\n * and GMT+01:00:00 after that date)\n *\n * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,\n * which would lead to incorrect calculations.\n *\n * This function returns the timezone offset in milliseconds that takes seconds in account.\n */\nexport function getTimezoneOffsetInMilliseconds(date) {\n const _date = toDate(date);\n const utcDate = new Date(\n Date.UTC(\n _date.getFullYear(),\n _date.getMonth(),\n _date.getDate(),\n _date.getHours(),\n _date.getMinutes(),\n _date.getSeconds(),\n _date.getMilliseconds(),\n ),\n );\n utcDate.setUTCFullYear(_date.getFullYear());\n return +date - +utcDate;\n}\n","import { constructFrom } from \"../constructFrom.js\";\n\nexport function normalizeDates(context, ...dates) {\n const normalize = constructFrom.bind(\n null,\n context || dates.find((date) => typeof date === \"object\"),\n );\n return dates.map(normalize);\n}\n","import { toDate } from \"./toDate.js\";\n\n/**\n * The {@link startOfDay} function options.\n */\n\n/**\n * @name startOfDay\n * @category Day Helpers\n * @summary Return the start of a day for the given date.\n *\n * @description\n * Return the start of a day for the given date.\n * The result will be in the local timezone.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The original date\n * @param options - The options\n *\n * @returns The start of a day\n *\n * @example\n * // The start of a day for 2 September 2014 11:55:00:\n * const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Tue Sep 02 2014 00:00:00\n */\nexport function startOfDay(date, options) {\n const _date = toDate(date, options?.in);\n _date.setHours(0, 0, 0, 0);\n return _date;\n}\n\n// Fallback for modularized imports:\nexport default startOfDay;\n","import { getTimezoneOffsetInMilliseconds } from \"./_lib/getTimezoneOffsetInMilliseconds.js\";\nimport { normalizeDates } from \"./_lib/normalizeDates.js\";\nimport { millisecondsInDay } from \"./constants.js\";\nimport { startOfDay } from \"./startOfDay.js\";\n\n/**\n * The {@link differenceInCalendarDays} function options.\n */\n\n/**\n * @name differenceInCalendarDays\n * @category Day Helpers\n * @summary Get the number of calendar days between the given dates.\n *\n * @description\n * Get the number of calendar days between the given dates. This means that the times are removed\n * from the dates and then the difference in days is calculated.\n *\n * @param laterDate - The later date\n * @param earlierDate - The earlier date\n * @param options - The options object\n *\n * @returns The number of calendar days\n *\n * @example\n * // How many calendar days are between\n * // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?\n * const result = differenceInCalendarDays(\n * new Date(2012, 6, 2, 0, 0),\n * new Date(2011, 6, 2, 23, 0)\n * )\n * //=> 366\n * // How many calendar days are between\n * // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?\n * const result = differenceInCalendarDays(\n * new Date(2011, 6, 3, 0, 1),\n * new Date(2011, 6, 2, 23, 59)\n * )\n * //=> 1\n */\nexport function differenceInCalendarDays(laterDate, earlierDate, options) {\n const [laterDate_, earlierDate_] = normalizeDates(\n options?.in,\n laterDate,\n earlierDate,\n );\n\n const laterStartOfDay = startOfDay(laterDate_);\n const earlierStartOfDay = startOfDay(earlierDate_);\n\n const laterTimestamp =\n +laterStartOfDay - getTimezoneOffsetInMilliseconds(laterStartOfDay);\n const earlierTimestamp =\n +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay);\n\n // Round the number of days to the nearest integer because the number of\n // milliseconds in a day is not constant (e.g. it's different in the week of\n // the daylight saving time clock shift).\n return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay);\n}\n\n// Fallback for modularized imports:\nexport default differenceInCalendarDays;\n","import { toDate } from \"./toDate.js\";\n\n/**\n * The {@link endOfDay} function options.\n */\n\n/**\n * @name endOfDay\n * @category Day Helpers\n * @summary Return the end of a day for the given date.\n *\n * @description\n * Return the end of a day for the given date.\n * The result will be in the local timezone.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The original date\n * @param options - An object with options\n *\n * @returns The end of a day\n *\n * @example\n * // The end of a day for 2 September 2014 11:55:00:\n * const result = endOfDay(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Tue Sep 02 2014 23:59:59.999\n */\nexport function endOfDay(date, options) {\n const _date = toDate(date, options?.in);\n _date.setHours(23, 59, 59, 999);\n return _date;\n}\n\n// Fallback for modularized imports:\nexport default endOfDay;\n","import { toDate } from \"./toDate.js\";\n\n/**\n * The {@link isWithinInterval} function options.\n */\n\n/**\n * @name isWithinInterval\n * @category Interval Helpers\n * @summary Is the given date within the interval?\n *\n * @description\n * Is the given date within the interval? (Including start and end.)\n *\n * @param date - The date to check\n * @param interval - The interval to check\n * @param options - An object with options\n *\n * @returns The date is within the interval\n *\n * @example\n * // For the date within the interval:\n * isWithinInterval(new Date(2014, 0, 3), {\n * start: new Date(2014, 0, 1),\n * end: new Date(2014, 0, 7)\n * })\n * // => true\n *\n * @example\n * // For the date outside of the interval:\n * isWithinInterval(new Date(2014, 0, 10), {\n * start: new Date(2014, 0, 1),\n * end: new Date(2014, 0, 7)\n * })\n * // => false\n *\n * @example\n * // For date equal to the interval start:\n * isWithinInterval(date, { start, end: date })\n * // => true\n *\n * @example\n * // For date equal to the interval end:\n * isWithinInterval(date, { start: date, end })\n * // => true\n */\nexport function isWithinInterval(date, interval, options) {\n const time = +toDate(date, options?.in);\n const [startTime, endTime] = [\n +toDate(interval.start, options?.in),\n +toDate(interval.end, options?.in),\n ].sort((a, b) => a - b);\n\n return time >= startTime && time <= endTime;\n}\n\n// Fallback for modularized imports:\nexport default isWithinInterval;\n","/**\n * The Nepali calendar data from 1975 BS to 2099 BS.\n * Based on the array index months days (0 → 11th), total days in year (12th)\n */\nconst years: number[][] = [];\n// fill years and their months\nyears[1975] = [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30, 365];\nyears[1976] = [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31, 366];\nyears[1977] = [30, 32, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31, 365];\nyears[1978] = [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30, 365];\nyears[1979] = years[1975];\nyears[1980] = years[1976];\nyears[1981] = [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31, 365];\nyears[1982] = years[1978];\nyears[1983] = years[1975];\nyears[1984] = years[1976];\nyears[1985] = [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30, 365];\nyears[1986] = years[1978];\nyears[1987] = [31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30, 365];\nyears[1988] = years[1976];\nyears[1989] = [31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30, 365];\nyears[1990] = years[1978];\nyears[1991] = [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30, 365];\nyears[1992] = [31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31, 366];\nyears[1993] = years[1989];\nyears[1994] = years[1978];\nyears[1995] = years[1991];\nyears[1996] = years[1992];\nyears[1997] = years[1978];\nyears[1998] = [31, 31, 32, 31, 32, 30, 30, 29, 30, 29, 30, 30, 365];\nyears[1999] = years[1976];\nyears[2000] = [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31, 365];\nyears[2001] = years[1978];\nyears[2002] = years[1975];\nyears[2003] = years[1976];\nyears[2004] = years[2000];\nyears[2005] = years[1978];\nyears[2006] = years[1975];\nyears[2007] = years[1976];\nyears[2008] = years[1981];\nyears[2009] = years[1978];\nyears[2010] = years[1975];\nyears[2011] = years[1976];\nyears[2012] = years[1985];\nyears[2013] = years[1978];\nyears[2014] = years[1975];\nyears[2015] = years[1976];\nyears[2016] = years[1985];\nyears[2017] = years[1978];\nyears[2018] = years[1987];\nyears[2019] = years[1992];\nyears[2020] = years[1989];\nyears[2021] = years[1978];\nyears[2022] = years[1991];\nyears[2023] = years[1992];\nyears[2024] = years[1989];\nyears[2025] = years[1978];\nyears[2026] = years[1976];\nyears[2027] = years[2000];\nyears[2028] = years[1978];\nyears[2029] = years[1998];\nyears[2030] = years[1976];\nyears[2031] = years[2000];\nyears[2032] = years[1978];\nyears[2033] = years[1975];\nyears[2034] = years[1976];\nyears[2035] = years[1977];\nyears[2036] = years[1978];\nyears[2037] = years[1975];\nyears[2038] = years[1976];\nyears[2039] = years[1985];\nyears[2040] = years[1978];\nyears[2041] = years[1975];\nyears[2042] = years[1976];\nyears[2043] = years[1985];\nyears[2044] = years[1978];\nyears[2045] = years[1987];\nyears[2046] = years[1976];\nyears[2047] = years[1989];\nyears[2048] = years[1978];\nyears[2049] = years[1991];\nyears[2050] = years[1992];\nyears[2051] = years[1989];\nyears[2052] = years[1978];\nyears[2053] = years[1991];\nyears[2054] = years[1992];\nyears[2055] = years[1978];\nyears[2056] = years[1998];\nyears[2057] = years[1976];\nyears[2058] = years[2000];\nyears[2059] = years[1978];\nyears[2060] = years[1975];\nyears[2061] = years[1976];\nyears[2062] = [30, 32, 31, 32, 31, 31, 29, 30, 29, 30, 29, 31, 365];\nyears[2063] = years[1978];\nyears[2064] = years[1975];\nyears[2065] = years[1976];\nyears[2066] = years[1981];\nyears[2067] = years[1978];\nyears[2068] = years[1975];\nyears[2069] = years[1976];\nyears[2070] = years[1985];\nyears[2071] = years[1978];\nyears[2072] = years[1987];\nyears[2073] = years[1976];\nyears[2074] = years[1989];\nyears[2075] = years[1978];\nyears[2076] = years[1991];\nyears[2077] = years[1992];\nyears[2078] = years[1989];\nyears[2079] = years[1978];\nyears[2080] = years[1991];\nyears[2081] = years[1992];\nyears[2082] = years[1989];\nyears[2083] = years[1978];\nyears[2084] = years[1976];\nyears[2085] = years[2000];\nyears[2086] = years[1978];\nyears[2087] = years[1975];\nyears[2088] = years[1976];\nyears[2089] = years[2000];\nyears[2090] = years[1978];\nyears[2091] = years[1975];\nyears[2092] = years[1976];\nyears[2093] = years[1981];\nyears[2094] = years[1978];\nyears[2095] = years[1975];\nyears[2096] = years[1976];\nyears[2097] = years[1985];\nyears[2098] = years[1978];\nyears[2099] = years[1975];\n\n// export years data\nexport { years };\n","import {\n addDays,\n differenceInCalendarDays,\n endOfDay,\n isWithinInterval,\n startOfDay,\n} from 'date-fns';\n\nimport { years } from './years';\n\nexport default class DateConverter {\n // Supported date range for the Nepali calendar (1975 BS - 2099 BS)\n private readonly startDate = new Date('1918-04-13'); // 1975-01-01 BS\n private readonly endDate = new Date('2043-04-13'); // 2099-12-30 BS\n private readonly dateRangeError = 'The input date is out of supported range.';\n\n // Extracted values from the input date string\n private readonly inputYear: number;\n private readonly inputMonth: number;\n private readonly inputDate: number;\n\n constructor(strDate: string) {\n // Parse and clean the input date string\n const [year, month, date] = this.parseDateString(strDate);\n this.inputYear = year;\n this.inputMonth = month;\n this.inputDate = date;\n }\n\n /**\n * Parses and cleans the input date string.\n * Converts Nepali numerals to English and splits into year, month, and date.\n */\n private parseDateString(strDate: string): [number, number, number] {\n const cleanedDate = this.numToEn(strDate)\n .replace(/[./|,]/g, '-')\n .trim();\n const [year, month, date] = cleanedDate.split('-').map(Number);\n\n return [year, month, date];\n }\n\n /**\n * Converts Nepali numerals (०-९) to English numerals (0-9).\n */\n private numToEn(strNum: string): string {\n const nepaliNumerals = ['०', '१', '२', '३', '४', '५', '६', '७', '८', '९'];\n\n return strNum.replace(/[०१२३४५६७८९]/g, (char) =>\n nepaliNumerals.indexOf(char).toString(),\n );\n }\n\n /**\n * Converts a day index (0-6) to a day name (Sunday-Saturday).\n */\n private numToDay(dayIndex: number): string {\n const days = [\n 'Sunday',\n 'Monday',\n 'Tuesday',\n 'Wednesday',\n 'Thursday',\n 'Friday',\n 'Saturday',\n ];\n\n return days[dayIndex];\n }\n\n /**\n * Calculates the AD date for a given BS date.\n * Uses the total days difference from the start date (1975-01-01 BS).\n */\n private getAdDate(year: number, month: number, date: number): Date {\n let totalDays = 0;\n\n // Add days for each year before the input year\n for (let y = 1975; y < year; y++) {\n totalDays += years[y][12]; // daysInYear is stored at index 12\n }\n\n // Add days for each month before the input month\n for (let m = 0; m < month - 1; m++) {\n totalDays += years[year][m];\n }\n\n // Add days for the current month\n totalDays += date - 1; // Subtract 1 to exclude the current day\n\n return addDays(this.startDate, totalDays);\n }\n\n /**\n * Calculates the BS date for a given AD date.\n * Uses the total days difference from the start date (1975-01-01 BS).\n */\n private getBsDate(givenDate: string): {\n year: number;\n month: number;\n date: number;\n } {\n const targetDate = new Date(givenDate);\n let remainingDays = differenceInCalendarDays(targetDate, this.startDate);\n\n // Iterate through years and months to find the BS date\n for (const year in years) {\n const daysInYear = years[year][12];\n\n if (remainingDays >= daysInYear) {\n remainingDays -= daysInYear;\n continue;\n }\n\n for (let month = 0; month < 12; month++) {\n const daysInMonth = years[year][month];\n\n if (remainingDays >= daysInMonth) {\n remainingDays -= daysInMonth;\n continue;\n }\n\n // Return the calculated BS date\n return {\n year: Number(year),\n month: month + 1,\n date: remainingDays + 1,\n };\n }\n }\n\n throw new Error(this.dateRangeError);\n }\n\n /**\n * Converts the input BS date to an AD date.\n * Returns an object with year, month, date, and day.\n */\n public toAd() {\n // Validate the input year range\n if (this.inputYear < 1975 || this.inputYear > 2099) {\n throw new Error(this.dateRangeError);\n }\n\n // Calculate the AD date and weekday\n const adDate = this.getAdDate(\n this.inputYear,\n this.inputMonth,\n this.inputDate,\n );\n const weekday = this.numToDay(adDate.getDay());\n\n return {\n year: adDate.getFullYear(),\n month: adDate.getMonth() + 1,\n date: adDate.getDate(),\n day: weekday,\n };\n }\n\n /**\n * Converts the input AD date to a BS date.\n * Returns an object with year, month, date, and day.\n */\n public toBs() {\n // Format the input date string\n const inputDate = `${this.inputYear}-${this.inputMonth}-${this.inputDate}`;\n const targetDate = new Date(inputDate);\n\n // Validate the input date range\n if (\n !isWithinInterval(targetDate, {\n start: startOfDay(this.startDate),\n end: endOfDay(this.endDate),\n })\n ) {\n throw new Error(this.dateRangeError);\n }\n\n // Calculate the BS date and weekday\n const bsDate = this.getBsDate(inputDate);\n const weekday = this.numToDay(targetDate.getDay());\n\n return { ...bsDate, day: weekday };\n }\n}\n"],"names":["constructFromSymbol","constructFrom","date","value","toDate","argument","context","addDays","amount","options","_date","getTimezoneOffsetInMilliseconds","utcDate","normalizeDates","dates","normalize","startOfDay","differenceInCalendarDays","laterDate","earlierDate","laterDate_","earlierDate_","laterStartOfDay","earlierStartOfDay","laterTimestamp","earlierTimestamp","endOfDay","isWithinInterval","interval","time","startTime","endTime","a","b","years","DateConverter","strDate","__publicField","year","month","cleanedDate","strNum","nepaliNumerals","char","dayIndex","totalDays","y","m","givenDate","targetDate","remainingDays","daysInYear","daysInMonth","adDate","weekday","inputDate","bsDate"],"mappings":"8MAuNO,MAAMA,EAAsB,OAAO,IAAI,mBAAmB,EClL1D,SAASC,EAAcC,EAAMC,EAAO,CACzC,OAAI,OAAOD,GAAS,WAAmBA,EAAKC,CAAK,EAE7CD,GAAQ,OAAOA,GAAS,UAAYF,KAAuBE,EACtDA,EAAKF,CAAmB,EAAEG,CAAK,EAEpCD,aAAgB,KAAa,IAAIA,EAAK,YAAYC,CAAK,EAEpD,IAAI,KAAKA,CAAK,CACvB,CCNO,SAASC,EAAOC,EAAUC,EAAS,CAExC,OAAOL,EAAyBI,EAAUA,CAAQ,CACpD,CCdO,SAASE,EAAQL,EAAMM,EAAQC,EAAS,CAC7C,MAAMC,EAAQN,EAAOF,CAAiB,EACtC,OAAI,MAAMM,CAAM,EAAUP,EAA6BC,EAAM,GAAG,GAG3DM,GAELE,EAAM,QAAQA,EAAM,QAAO,EAAKF,CAAM,EAC/BE,EACT,CCzBO,SAASC,EAAgCT,EAAM,CACpD,MAAMQ,EAAQN,EAAOF,CAAI,EACnBU,EAAU,IAAI,KAClB,KAAK,IACHF,EAAM,YAAa,EACnBA,EAAM,SAAU,EAChBA,EAAM,QAAS,EACfA,EAAM,SAAU,EAChBA,EAAM,WAAY,EAClBA,EAAM,WAAY,EAClBA,EAAM,gBAAiB,CACxB,CACF,EACD,OAAAE,EAAQ,eAAeF,EAAM,aAAa,EACnC,CAACR,EAAO,CAACU,CAClB,CC1BO,SAASC,EAAeP,KAAYQ,EAAO,CAChD,MAAMC,EAAYd,EAAc,KAC9B,KACWa,EAAM,KAAMZ,GAAS,OAAOA,GAAS,QAAQ,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AQ,EACrB,IAAKC,CACP,CAAA,CAOK,MAAO,CAEN,MAAAC,EAAY,GAAG,KAAK,SAAS,IAAI,KAAK,UAAU,IAAI,KAAK,SAAS,GAClEN,EAAa,IAAI,KAAKM,CAAS,EAInC,GAAA,CAAC5B,EAAiBsB,EAAY,CAC5B,MAAOjC,EAAW,KAAK,SAAS,EAChC,IAAKU,EAAS,KAAK,OAAO,CAAA,CAC3B,EAEK,MAAA,IAAI,MAAM,KAAK,cAAc,EAI/B,MAAA8B,EAAS,KAAK,UAAUD,CAAS,EACjCD,EAAU,KAAK,SAASL,EAAW,QAAQ,EAEjD,MAAO,CAAE,GAAGO,EAAQ,IAAKF,CAAQ,CAAA,CAErC","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9]}
package/ndc-node.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";var m=Object.defineProperty;var p=(r,e,n)=>e in r?m(r,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[e]=n;var u=(r,e,n)=>p(r,typeof e!="symbol"?e+"":e,n);const y=Symbol.for("constructDateFrom");function h(r,e){return typeof r=="function"?r(e):r&&typeof r=="object"&&y in r?r[y](e):r instanceof Date?new r.constructor(e):new Date(e)}function c(r,e){return h(r,r)}function g(r,e,n){const a=c(r);return isNaN(e)?h(r,NaN):(e&&a.setDate(a.getDate()+e),a)}function f(r){const e=c(r),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+r-+n}function w(r,...e){const n=h.bind(null,e.find(a=>typeof a=="object"));return e.map(n)}function d(r,e){const n=c(r);return n.setHours(0,0,0,0),n}function T(r,e,n){const[a,s]=w(n==null?void 0:n.in,r,e),o=d(a),i=d(s),D=+o-f(o),l=+i-f(i);return Math.round((D-l)/864e5)}function M(r,e){const n=c(r);return n.setHours(23,59,59,999),n}function Y(r,e,n){const a=+c(r),[s,o]=[+c(e.start),+c(e.end)].sort((i,D)=>i-D);return a>=s&&a<=o}const t=[];t[1975]=[31,31,32,32,31,30,30,29,30,29,30,30,365];t[1976]=[31,32,31,32,31,30,30,30,29,29,30,31,366];t[1977]=[30,32,31,32,31,31,29,30,30,29,29,31,365];t[1978]=[31,31,32,31,31,31,30,29,30,29,30,30,365];t[1979]=t[1975];t[1980]=t[1976];t[1981]=[31,31,31,32,31,31,29,30,30,29,29,31,365];t[1982]=t[1978];t[1983]=t[1975];t[1984]=t[1976];t[1985]=[31,31,31,32,31,31,29,30,30,29,30,30,365];t[1986]=t[1978];t[1987]=[31,32,31,32,31,30,30,29,30,29,30,30,365];t[1988]=t[1976];t[1989]=[31,31,31,32,31,31,30,29,30,29,30,30,365];t[1990]=t[1978];t[1991]=[31,32,31,32,31,30,30,30,29,29,30,30,365];t[1992]=[31,32,31,32,31,30,30,30,29,30,29,31,366];t[1993]=t[1989];t[1994]=t[1978];t[1995]=t[1991];t[1996]=t[1992];t[1997]=t[1978];t[1998]=[31,31,32,31,32,30,30,29,30,29,30,30,365];t[1999]=t[1976];t[2e3]=[30,32,31,32,31,30,30,30,29,30,29,31,365];t[2001]=t[1978];t[2002]=t[1975];t[2003]=t[1976];t[2004]=t[2e3];t[2005]=t[1978];t[2006]=t[1975];t[2007]=t[1976];t[2008]=t[1981];t[2009]=t[1978];t[2010]=t[1975];t[2011]=t[1976];t[2012]=t[1985];t[2013]=t[1978];t[2014]=t[1975];t[2015]=t[1976];t[2016]=t[1985];t[2017]=t[1978];t[2018]=t[1987];t[2019]=t[1992];t[2020]=t[1989];t[2021]=t[1978];t[2022]=t[1991];t[2023]=t[1992];t[2024]=t[1989];t[2025]=t[1978];t[2026]=t[1976];t[2027]=t[2e3];t[2028]=t[1978];t[2029]=t[1998];t[2030]=t[1976];t[2031]=t[2e3];t[2032]=t[1978];t[2033]=t[1975];t[2034]=t[1976];t[2035]=t[1977];t[2036]=t[1978];t[2037]=t[1975];t[2038]=t[1976];t[2039]=t[1985];t[2040]=t[1978];t[2041]=t[1975];t[2042]=t[1976];t[2043]=t[1985];t[2044]=t[1978];t[2045]=t[1987];t[2046]=t[1976];t[2047]=t[1989];t[2048]=t[1978];t[2049]=t[1991];t[2050]=t[1992];t[2051]=t[1989];t[2052]=t[1978];t[2053]=t[1991];t[2054]=t[1992];t[2055]=t[1978];t[2056]=t[1998];t[2057]=t[1976];t[2058]=t[2e3];t[2059]=t[1978];t[2060]=t[1975];t[2061]=t[1976];t[2062]=[30,32,31,32,31,31,29,30,29,30,29,31,365];t[2063]=t[1978];t[2064]=t[1975];t[2065]=t[1976];t[2066]=t[1981];t[2067]=t[1978];t[2068]=t[1975];t[2069]=t[1976];t[2070]=t[1985];t[2071]=t[1978];t[2072]=t[1987];t[2073]=t[1976];t[2074]=t[1989];t[2075]=t[1978];t[2076]=t[1991];t[2077]=t[1992];t[2078]=t[1989];t[2079]=t[1978];t[2080]=t[1991];t[2081]=t[1992];t[2082]=t[1989];t[2083]=t[1978];t[2084]=t[1976];t[2085]=t[2e3];t[2086]=t[1978];t[2087]=t[1975];t[2088]=t[1976];t[2089]=t[2e3];t[2090]=t[1978];t[2091]=t[1975];t[2092]=t[1976];t[2093]=t[1981];t[2094]=t[1978];t[2095]=t[1975];t[2096]=t[1976];t[2097]=t[1985];t[2098]=t[1978];t[2099]=t[1975];class S{constructor(e){u(this,"startDate",new Date("1918-04-13"));u(this,"endDate",new Date("2043-04-13"));u(this,"dateRangeError","The input date is out of supported range.");u(this,"inputYear");u(this,"inputMonth");u(this,"inputDate");const[n,a,s]=this.parseDateString(e);this.inputYear=n,this.inputMonth=a,this.inputDate=s}parseDateString(e){const n=this.numToEn(e).replace(/[./|,]/g,"-").trim(),[a,s,o]=n.split("-").map(Number);return[a,s,o]}numToEn(e){const n=["०","१","२","३","४","५","६","७","८","९"];return e.replace(/[०१२३४५६७८९]/g,a=>n.indexOf(a).toString())}numToDay(e){return["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][e]}getAdDate(e,n,a){let s=0;for(let o=1975;o<e;o++)s+=t[o][12];for(let o=0;o<n-1;o++)s+=t[e][o];return s+=a-1,g(this.startDate,s)}getBsDate(e){const n=new Date(e);let a=T(n,this.startDate);for(const s in t){const o=t[s][12];if(a>=o){a-=o;continue}for(let i=0;i<12;i++){const D=t[s][i];if(a>=D){a-=D;continue}return{year:Number(s),month:i+1,date:a+1}}}throw new Error(this.dateRangeError)}toAd(){if(this.inputYear<1975||this.inputYear>2099)throw new Error(this.dateRangeError);const e=this.getAdDate(this.inputYear,this.inputMonth,this.inputDate),n=this.numToDay(e.getDay());return{year:e.getFullYear(),month:e.getMonth()+1,date:e.getDate(),day:n}}toBs(){const e=`${this.inputYear}-${this.inputMonth}-${this.inputDate}`,n=new Date(e);if(!Y(n,{start:d(this.startDate),end:M(this.endDate)}))throw new Error(this.dateRangeError);const a=this.getBsDate(e),s=this.numToDay(n.getDay());return{...a,day:s}}}module.exports=S;
2
+ //# sourceMappingURL=ndc-node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ndc-node.js","sources":["../node_modules/date-fns/constants.js","../node_modules/date-fns/constructFrom.js","../node_modules/date-fns/toDate.js","../node_modules/date-fns/addDays.js","../node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js","../node_modules/date-fns/_lib/normalizeDates.js","../node_modules/date-fns/startOfDay.js","../node_modules/date-fns/differenceInCalendarDays.js","../node_modules/date-fns/endOfDay.js","../node_modules/date-fns/isWithinInterval.js","../src/years.ts","../src/index.ts"],"sourcesContent":["/**\n * @module constants\n * @summary Useful constants\n * @description\n * Collection of useful date constants.\n *\n * The constants could be imported from `date-fns/constants`:\n *\n * ```ts\n * import { maxTime, minTime } from \"./constants/date-fns/constants\";\n *\n * function isAllowedTime(time) {\n * return time <= maxTime && time >= minTime;\n * }\n * ```\n */\n\n/**\n * @constant\n * @name daysInWeek\n * @summary Days in 1 week.\n */\nexport const daysInWeek = 7;\n\n/**\n * @constant\n * @name daysInYear\n * @summary Days in 1 year.\n *\n * @description\n * How many days in a year.\n *\n * One years equals 365.2425 days according to the formula:\n *\n * > Leap year occurs every 4 years, except for years that are divisible by 100 and not divisible by 400.\n * > 1 mean year = (365+1/4-1/100+1/400) days = 365.2425 days\n */\nexport const daysInYear = 365.2425;\n\n/**\n * @constant\n * @name maxTime\n * @summary Maximum allowed time.\n *\n * @example\n * import { maxTime } from \"./constants/date-fns/constants\";\n *\n * const isValid = 8640000000000001 <= maxTime;\n * //=> false\n *\n * new Date(8640000000000001);\n * //=> Invalid Date\n */\nexport const maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1000;\n\n/**\n * @constant\n * @name minTime\n * @summary Minimum allowed time.\n *\n * @example\n * import { minTime } from \"./constants/date-fns/constants\";\n *\n * const isValid = -8640000000000001 >= minTime;\n * //=> false\n *\n * new Date(-8640000000000001)\n * //=> Invalid Date\n */\nexport const minTime = -maxTime;\n\n/**\n * @constant\n * @name millisecondsInWeek\n * @summary Milliseconds in 1 week.\n */\nexport const millisecondsInWeek = 604800000;\n\n/**\n * @constant\n * @name millisecondsInDay\n * @summary Milliseconds in 1 day.\n */\nexport const millisecondsInDay = 86400000;\n\n/**\n * @constant\n * @name millisecondsInMinute\n * @summary Milliseconds in 1 minute\n */\nexport const millisecondsInMinute = 60000;\n\n/**\n * @constant\n * @name millisecondsInHour\n * @summary Milliseconds in 1 hour\n */\nexport const millisecondsInHour = 3600000;\n\n/**\n * @constant\n * @name millisecondsInSecond\n * @summary Milliseconds in 1 second\n */\nexport const millisecondsInSecond = 1000;\n\n/**\n * @constant\n * @name minutesInYear\n * @summary Minutes in 1 year.\n */\nexport const minutesInYear = 525600;\n\n/**\n * @constant\n * @name minutesInMonth\n * @summary Minutes in 1 month.\n */\nexport const minutesInMonth = 43200;\n\n/**\n * @constant\n * @name minutesInDay\n * @summary Minutes in 1 day.\n */\nexport const minutesInDay = 1440;\n\n/**\n * @constant\n * @name minutesInHour\n * @summary Minutes in 1 hour.\n */\nexport const minutesInHour = 60;\n\n/**\n * @constant\n * @name monthsInQuarter\n * @summary Months in 1 quarter.\n */\nexport const monthsInQuarter = 3;\n\n/**\n * @constant\n * @name monthsInYear\n * @summary Months in 1 year.\n */\nexport const monthsInYear = 12;\n\n/**\n * @constant\n * @name quartersInYear\n * @summary Quarters in 1 year\n */\nexport const quartersInYear = 4;\n\n/**\n * @constant\n * @name secondsInHour\n * @summary Seconds in 1 hour.\n */\nexport const secondsInHour = 3600;\n\n/**\n * @constant\n * @name secondsInMinute\n * @summary Seconds in 1 minute.\n */\nexport const secondsInMinute = 60;\n\n/**\n * @constant\n * @name secondsInDay\n * @summary Seconds in 1 day.\n */\nexport const secondsInDay = secondsInHour * 24;\n\n/**\n * @constant\n * @name secondsInWeek\n * @summary Seconds in 1 week.\n */\nexport const secondsInWeek = secondsInDay * 7;\n\n/**\n * @constant\n * @name secondsInYear\n * @summary Seconds in 1 year.\n */\nexport const secondsInYear = secondsInDay * daysInYear;\n\n/**\n * @constant\n * @name secondsInMonth\n * @summary Seconds in 1 month\n */\nexport const secondsInMonth = secondsInYear / 12;\n\n/**\n * @constant\n * @name secondsInQuarter\n * @summary Seconds in 1 quarter.\n */\nexport const secondsInQuarter = secondsInMonth * 3;\n\n/**\n * @constant\n * @name constructFromSymbol\n * @summary Symbol enabling Date extensions to inherit properties from the reference date.\n *\n * The symbol is used to enable the `constructFrom` function to construct a date\n * using a reference date and a value. It allows to transfer extra properties\n * from the reference date to the new date. It's useful for extensions like\n * [`TZDate`](https://github.com/date-fns/tz) that accept a time zone as\n * a constructor argument.\n */\nexport const constructFromSymbol = Symbol.for(\"constructDateFrom\");\n","import { constructFromSymbol } from \"./constants.js\";\n\n/**\n * @name constructFrom\n * @category Generic Helpers\n * @summary Constructs a date using the reference date and the value\n *\n * @description\n * The function constructs a new date using the constructor from the reference\n * date and the given value. It helps to build generic functions that accept\n * date extensions.\n *\n * It defaults to `Date` if the passed reference date is a number or a string.\n *\n * Starting from v3.7.0, it allows to construct a date using `[Symbol.for(\"constructDateFrom\")]`\n * enabling to transfer extra properties from the reference date to the new date.\n * It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz)\n * that accept a time zone as a constructor argument.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n *\n * @param date - The reference date to take constructor from\n * @param value - The value to create the date\n *\n * @returns Date initialized using the given date and value\n *\n * @example\n * import { constructFrom } from \"./constructFrom/date-fns\";\n *\n * // A function that clones a date preserving the original type\n * function cloneDate<DateType extends Date>(date: DateType): DateType {\n * return constructFrom(\n * date, // Use constructor from the given date\n * date.getTime() // Use the date value to create a new date\n * );\n * }\n */\nexport function constructFrom(date, value) {\n if (typeof date === \"function\") return date(value);\n\n if (date && typeof date === \"object\" && constructFromSymbol in date)\n return date[constructFromSymbol](value);\n\n if (date instanceof Date) return new date.constructor(value);\n\n return new Date(value);\n}\n\n// Fallback for modularized imports:\nexport default constructFrom;\n","import { constructFrom } from \"./constructFrom.js\";\n\n/**\n * @name toDate\n * @category Common Helpers\n * @summary Convert the given argument to an instance of Date.\n *\n * @description\n * Convert the given argument to an instance of Date.\n *\n * If the argument is an instance of Date, the function returns its clone.\n *\n * If the argument is a number, it is treated as a timestamp.\n *\n * If the argument is none of the above, the function returns Invalid Date.\n *\n * Starting from v3.7.0, it clones a date using `[Symbol.for(\"constructDateFrom\")]`\n * enabling to transfer extra properties from the reference date to the new date.\n * It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz)\n * that accept a time zone as a constructor argument.\n *\n * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param argument - The value to convert\n *\n * @returns The parsed date in the local time zone\n *\n * @example\n * // Clone the date:\n * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))\n * //=> Tue Feb 11 2014 11:30:30\n *\n * @example\n * // Convert the timestamp to date:\n * const result = toDate(1392098430000)\n * //=> Tue Feb 11 2014 11:30:30\n */\nexport function toDate(argument, context) {\n // [TODO] Get rid of `toDate` or `constructFrom`?\n return constructFrom(context || argument, argument);\n}\n\n// Fallback for modularized imports:\nexport default toDate;\n","import { constructFrom } from \"./constructFrom.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link addDays} function options.\n */\n\n/**\n * @name addDays\n * @category Day Helpers\n * @summary Add the specified number of days to the given date.\n *\n * @description\n * Add the specified number of days to the given date.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The date to be changed\n * @param amount - The amount of days to be added.\n * @param options - An object with options\n *\n * @returns The new date with the days added\n *\n * @example\n * // Add 10 days to 1 September 2014:\n * const result = addDays(new Date(2014, 8, 1), 10)\n * //=> Thu Sep 11 2014 00:00:00\n */\nexport function addDays(date, amount, options) {\n const _date = toDate(date, options?.in);\n if (isNaN(amount)) return constructFrom(options?.in || date, NaN);\n\n // If 0 days, no-op to avoid changing times in the hour before end of DST\n if (!amount) return _date;\n\n _date.setDate(_date.getDate() + amount);\n return _date;\n}\n\n// Fallback for modularized imports:\nexport default addDays;\n","import { toDate } from \"../toDate.js\";\n\n/**\n * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.\n * They usually appear for dates that denote time before the timezones were introduced\n * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891\n * and GMT+01:00:00 after that date)\n *\n * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,\n * which would lead to incorrect calculations.\n *\n * This function returns the timezone offset in milliseconds that takes seconds in account.\n */\nexport function getTimezoneOffsetInMilliseconds(date) {\n const _date = toDate(date);\n const utcDate = new Date(\n Date.UTC(\n _date.getFullYear(),\n _date.getMonth(),\n _date.getDate(),\n _date.getHours(),\n _date.getMinutes(),\n _date.getSeconds(),\n _date.getMilliseconds(),\n ),\n );\n utcDate.setUTCFullYear(_date.getFullYear());\n return +date - +utcDate;\n}\n","import { constructFrom } from \"../constructFrom.js\";\n\nexport function normalizeDates(context, ...dates) {\n const normalize = constructFrom.bind(\n null,\n context || dates.find((date) => typeof date === \"object\"),\n );\n return dates.map(normalize);\n}\n","import { toDate } from \"./toDate.js\";\n\n/**\n * The {@link startOfDay} function options.\n */\n\n/**\n * @name startOfDay\n * @category Day Helpers\n * @summary Return the start of a day for the given date.\n *\n * @description\n * Return the start of a day for the given date.\n * The result will be in the local timezone.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The original date\n * @param options - The options\n *\n * @returns The start of a day\n *\n * @example\n * // The start of a day for 2 September 2014 11:55:00:\n * const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Tue Sep 02 2014 00:00:00\n */\nexport function startOfDay(date, options) {\n const _date = toDate(date, options?.in);\n _date.setHours(0, 0, 0, 0);\n return _date;\n}\n\n// Fallback for modularized imports:\nexport default startOfDay;\n","import { getTimezoneOffsetInMilliseconds } from \"./_lib/getTimezoneOffsetInMilliseconds.js\";\nimport { normalizeDates } from \"./_lib/normalizeDates.js\";\nimport { millisecondsInDay } from \"./constants.js\";\nimport { startOfDay } from \"./startOfDay.js\";\n\n/**\n * The {@link differenceInCalendarDays} function options.\n */\n\n/**\n * @name differenceInCalendarDays\n * @category Day Helpers\n * @summary Get the number of calendar days between the given dates.\n *\n * @description\n * Get the number of calendar days between the given dates. This means that the times are removed\n * from the dates and then the difference in days is calculated.\n *\n * @param laterDate - The later date\n * @param earlierDate - The earlier date\n * @param options - The options object\n *\n * @returns The number of calendar days\n *\n * @example\n * // How many calendar days are between\n * // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?\n * const result = differenceInCalendarDays(\n * new Date(2012, 6, 2, 0, 0),\n * new Date(2011, 6, 2, 23, 0)\n * )\n * //=> 366\n * // How many calendar days are between\n * // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?\n * const result = differenceInCalendarDays(\n * new Date(2011, 6, 3, 0, 1),\n * new Date(2011, 6, 2, 23, 59)\n * )\n * //=> 1\n */\nexport function differenceInCalendarDays(laterDate, earlierDate, options) {\n const [laterDate_, earlierDate_] = normalizeDates(\n options?.in,\n laterDate,\n earlierDate,\n );\n\n const laterStartOfDay = startOfDay(laterDate_);\n const earlierStartOfDay = startOfDay(earlierDate_);\n\n const laterTimestamp =\n +laterStartOfDay - getTimezoneOffsetInMilliseconds(laterStartOfDay);\n const earlierTimestamp =\n +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay);\n\n // Round the number of days to the nearest integer because the number of\n // milliseconds in a day is not constant (e.g. it's different in the week of\n // the daylight saving time clock shift).\n return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay);\n}\n\n// Fallback for modularized imports:\nexport default differenceInCalendarDays;\n","import { toDate } from \"./toDate.js\";\n\n/**\n * The {@link endOfDay} function options.\n */\n\n/**\n * @name endOfDay\n * @category Day Helpers\n * @summary Return the end of a day for the given date.\n *\n * @description\n * Return the end of a day for the given date.\n * The result will be in the local timezone.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The original date\n * @param options - An object with options\n *\n * @returns The end of a day\n *\n * @example\n * // The end of a day for 2 September 2014 11:55:00:\n * const result = endOfDay(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Tue Sep 02 2014 23:59:59.999\n */\nexport function endOfDay(date, options) {\n const _date = toDate(date, options?.in);\n _date.setHours(23, 59, 59, 999);\n return _date;\n}\n\n// Fallback for modularized imports:\nexport default endOfDay;\n","import { toDate } from \"./toDate.js\";\n\n/**\n * The {@link isWithinInterval} function options.\n */\n\n/**\n * @name isWithinInterval\n * @category Interval Helpers\n * @summary Is the given date within the interval?\n *\n * @description\n * Is the given date within the interval? (Including start and end.)\n *\n * @param date - The date to check\n * @param interval - The interval to check\n * @param options - An object with options\n *\n * @returns The date is within the interval\n *\n * @example\n * // For the date within the interval:\n * isWithinInterval(new Date(2014, 0, 3), {\n * start: new Date(2014, 0, 1),\n * end: new Date(2014, 0, 7)\n * })\n * // => true\n *\n * @example\n * // For the date outside of the interval:\n * isWithinInterval(new Date(2014, 0, 10), {\n * start: new Date(2014, 0, 1),\n * end: new Date(2014, 0, 7)\n * })\n * // => false\n *\n * @example\n * // For date equal to the interval start:\n * isWithinInterval(date, { start, end: date })\n * // => true\n *\n * @example\n * // For date equal to the interval end:\n * isWithinInterval(date, { start: date, end })\n * // => true\n */\nexport function isWithinInterval(date, interval, options) {\n const time = +toDate(date, options?.in);\n const [startTime, endTime] = [\n +toDate(interval.start, options?.in),\n +toDate(interval.end, options?.in),\n ].sort((a, b) => a - b);\n\n return time >= startTime && time <= endTime;\n}\n\n// Fallback for modularized imports:\nexport default isWithinInterval;\n","/**\n * The Nepali calendar data from 1975 BS to 2099 BS.\n * Based on the array index months days (0 → 11th), total days in year (12th)\n */\nconst years: number[][] = [];\n// fill years and their months\nyears[1975] = [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30, 365];\nyears[1976] = [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31, 366];\nyears[1977] = [30, 32, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31, 365];\nyears[1978] = [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30, 365];\nyears[1979] = years[1975];\nyears[1980] = years[1976];\nyears[1981] = [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31, 365];\nyears[1982] = years[1978];\nyears[1983] = years[1975];\nyears[1984] = years[1976];\nyears[1985] = [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30, 365];\nyears[1986] = years[1978];\nyears[1987] = [31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30, 365];\nyears[1988] = years[1976];\nyears[1989] = [31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30, 365];\nyears[1990] = years[1978];\nyears[1991] = [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30, 365];\nyears[1992] = [31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31, 366];\nyears[1993] = years[1989];\nyears[1994] = years[1978];\nyears[1995] = years[1991];\nyears[1996] = years[1992];\nyears[1997] = years[1978];\nyears[1998] = [31, 31, 32, 31, 32, 30, 30, 29, 30, 29, 30, 30, 365];\nyears[1999] = years[1976];\nyears[2000] = [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31, 365];\nyears[2001] = years[1978];\nyears[2002] = years[1975];\nyears[2003] = years[1976];\nyears[2004] = years[2000];\nyears[2005] = years[1978];\nyears[2006] = years[1975];\nyears[2007] = years[1976];\nyears[2008] = years[1981];\nyears[2009] = years[1978];\nyears[2010] = years[1975];\nyears[2011] = years[1976];\nyears[2012] = years[1985];\nyears[2013] = years[1978];\nyears[2014] = years[1975];\nyears[2015] = years[1976];\nyears[2016] = years[1985];\nyears[2017] = years[1978];\nyears[2018] = years[1987];\nyears[2019] = years[1992];\nyears[2020] = years[1989];\nyears[2021] = years[1978];\nyears[2022] = years[1991];\nyears[2023] = years[1992];\nyears[2024] = years[1989];\nyears[2025] = years[1978];\nyears[2026] = years[1976];\nyears[2027] = years[2000];\nyears[2028] = years[1978];\nyears[2029] = years[1998];\nyears[2030] = years[1976];\nyears[2031] = years[2000];\nyears[2032] = years[1978];\nyears[2033] = years[1975];\nyears[2034] = years[1976];\nyears[2035] = years[1977];\nyears[2036] = years[1978];\nyears[2037] = years[1975];\nyears[2038] = years[1976];\nyears[2039] = years[1985];\nyears[2040] = years[1978];\nyears[2041] = years[1975];\nyears[2042] = years[1976];\nyears[2043] = years[1985];\nyears[2044] = years[1978];\nyears[2045] = years[1987];\nyears[2046] = years[1976];\nyears[2047] = years[1989];\nyears[2048] = years[1978];\nyears[2049] = years[1991];\nyears[2050] = years[1992];\nyears[2051] = years[1989];\nyears[2052] = years[1978];\nyears[2053] = years[1991];\nyears[2054] = years[1992];\nyears[2055] = years[1978];\nyears[2056] = years[1998];\nyears[2057] = years[1976];\nyears[2058] = years[2000];\nyears[2059] = years[1978];\nyears[2060] = years[1975];\nyears[2061] = years[1976];\nyears[2062] = [30, 32, 31, 32, 31, 31, 29, 30, 29, 30, 29, 31, 365];\nyears[2063] = years[1978];\nyears[2064] = years[1975];\nyears[2065] = years[1976];\nyears[2066] = years[1981];\nyears[2067] = years[1978];\nyears[2068] = years[1975];\nyears[2069] = years[1976];\nyears[2070] = years[1985];\nyears[2071] = years[1978];\nyears[2072] = years[1987];\nyears[2073] = years[1976];\nyears[2074] = years[1989];\nyears[2075] = years[1978];\nyears[2076] = years[1991];\nyears[2077] = years[1992];\nyears[2078] = years[1989];\nyears[2079] = years[1978];\nyears[2080] = years[1991];\nyears[2081] = years[1992];\nyears[2082] = years[1989];\nyears[2083] = years[1978];\nyears[2084] = years[1976];\nyears[2085] = years[2000];\nyears[2086] = years[1978];\nyears[2087] = years[1975];\nyears[2088] = years[1976];\nyears[2089] = years[2000];\nyears[2090] = years[1978];\nyears[2091] = years[1975];\nyears[2092] = years[1976];\nyears[2093] = years[1981];\nyears[2094] = years[1978];\nyears[2095] = years[1975];\nyears[2096] = years[1976];\nyears[2097] = years[1985];\nyears[2098] = years[1978];\nyears[2099] = years[1975];\n\n// export years data\nexport { years };\n","import {\n addDays,\n differenceInCalendarDays,\n endOfDay,\n isWithinInterval,\n startOfDay,\n} from 'date-fns';\n\nimport { years } from './years';\n\nexport default class DateConverter {\n // Supported date range for the Nepali calendar (1975 BS - 2099 BS)\n private readonly startDate = new Date('1918-04-13'); // 1975-01-01 BS\n private readonly endDate = new Date('2043-04-13'); // 2099-12-30 BS\n private readonly dateRangeError = 'The input date is out of supported range.';\n\n // Extracted values from the input date string\n private readonly inputYear: number;\n private readonly inputMonth: number;\n private readonly inputDate: number;\n\n constructor(strDate: string) {\n // Parse and clean the input date string\n const [year, month, date] = this.parseDateString(strDate);\n this.inputYear = year;\n this.inputMonth = month;\n this.inputDate = date;\n }\n\n /**\n * Parses and cleans the input date string.\n * Converts Nepali numerals to English and splits into year, month, and date.\n */\n private parseDateString(strDate: string): [number, number, number] {\n const cleanedDate = this.numToEn(strDate)\n .replace(/[./|,]/g, '-')\n .trim();\n const [year, month, date] = cleanedDate.split('-').map(Number);\n\n return [year, month, date];\n }\n\n /**\n * Converts Nepali numerals (०-९) to English numerals (0-9).\n */\n private numToEn(strNum: string): string {\n const nepaliNumerals = ['०', '१', '२', '३', '४', '५', '६', '७', '८', '९'];\n\n return strNum.replace(/[०१२३४५६७८९]/g, (char) =>\n nepaliNumerals.indexOf(char).toString(),\n );\n }\n\n /**\n * Converts a day index (0-6) to a day name (Sunday-Saturday).\n */\n private numToDay(dayIndex: number): string {\n const days = [\n 'Sunday',\n 'Monday',\n 'Tuesday',\n 'Wednesday',\n 'Thursday',\n 'Friday',\n 'Saturday',\n ];\n\n return days[dayIndex];\n }\n\n /**\n * Calculates the AD date for a given BS date.\n * Uses the total days difference from the start date (1975-01-01 BS).\n */\n private getAdDate(year: number, month: number, date: number): Date {\n let totalDays = 0;\n\n // Add days for each year before the input year\n for (let y = 1975; y < year; y++) {\n totalDays += years[y][12]; // daysInYear is stored at index 12\n }\n\n // Add days for each month before the input month\n for (let m = 0; m < month - 1; m++) {\n totalDays += years[year][m];\n }\n\n // Add days for the current month\n totalDays += date - 1; // Subtract 1 to exclude the current day\n\n return addDays(this.startDate, totalDays);\n }\n\n /**\n * Calculates the BS date for a given AD date.\n * Uses the total days difference from the start date (1975-01-01 BS).\n */\n private getBsDate(givenDate: string): {\n year: number;\n month: number;\n date: number;\n } {\n const targetDate = new Date(givenDate);\n let remainingDays = differenceInCalendarDays(targetDate, this.startDate);\n\n // Iterate through years and months to find the BS date\n for (const year in years) {\n const daysInYear = years[year][12];\n\n if (remainingDays >= daysInYear) {\n remainingDays -= daysInYear;\n continue;\n }\n\n for (let month = 0; month < 12; month++) {\n const daysInMonth = years[year][month];\n\n if (remainingDays >= daysInMonth) {\n remainingDays -= daysInMonth;\n continue;\n }\n\n // Return the calculated BS date\n return {\n year: Number(year),\n month: month + 1,\n date: remainingDays + 1,\n };\n }\n }\n\n throw new Error(this.dateRangeError);\n }\n\n /**\n * Converts the input BS date to an AD date.\n * Returns an object with year, month, date, and day.\n */\n public toAd() {\n // Validate the input year range\n if (this.inputYear < 1975 || this.inputYear > 2099) {\n throw new Error(this.dateRangeError);\n }\n\n // Calculate the AD date and weekday\n const adDate = this.getAdDate(\n this.inputYear,\n this.inputMonth,\n this.inputDate,\n );\n const weekday = this.numToDay(adDate.getDay());\n\n return {\n year: adDate.getFullYear(),\n month: adDate.getMonth() + 1,\n date: adDate.getDate(),\n day: weekday,\n };\n }\n\n /**\n * Converts the input AD date to a BS date.\n * Returns an object with year, month, date, and day.\n */\n public toBs() {\n // Format the input date string\n const inputDate = `${this.inputYear}-${this.inputMonth}-${this.inputDate}`;\n const targetDate = new Date(inputDate);\n\n // Validate the input date range\n if (\n !isWithinInterval(targetDate, {\n start: startOfDay(this.startDate),\n end: endOfDay(this.endDate),\n })\n ) {\n throw new Error(this.dateRangeError);\n }\n\n // Calculate the BS date and weekday\n const bsDate = this.getBsDate(inputDate);\n const weekday = this.numToDay(targetDate.getDay());\n\n return { ...bsDate, day: weekday };\n }\n}\n"],"names":["constructFromSymbol","constructFrom","date","value","toDate","argument","context","addDays","amount","options","_date","getTimezoneOffsetInMilliseconds","utcDate","normalizeDates","dates","normalize","startOfDay","differenceInCalendarDays","laterDate","earlierDate","laterDate_","earlierDate_","laterStartOfDay","earlierStartOfDay","laterTimestamp","earlierTimestamp","endOfDay","isWithinInterval","interval","time","startTime","endTime","a","b","years","DateConverter","strDate","__publicField","year","month","cleanedDate","strNum","nepaliNumerals","char","dayIndex","totalDays","y","m","givenDate","targetDate","remainingDays","daysInYear","daysInMonth","adDate","weekday","inputDate","bsDate"],"mappings":"iLAuNO,MAAMA,EAAsB,OAAO,IAAI,mBAAmB,EClL1D,SAASC,EAAcC,EAAMC,EAAO,CACzC,OAAI,OAAOD,GAAS,WAAmBA,EAAKC,CAAK,EAE7CD,GAAQ,OAAOA,GAAS,UAAYF,KAAuBE,EACtDA,EAAKF,CAAmB,EAAEG,CAAK,EAEpCD,aAAgB,KAAa,IAAIA,EAAK,YAAYC,CAAK,EAEpD,IAAI,KAAKA,CAAK,CACvB,CCNO,SAASC,EAAOC,EAAUC,EAAS,CAExC,OAAOL,EAAyBI,EAAUA,CAAQ,CACpD,CCdO,SAASE,EAAQL,EAAMM,EAAQC,EAAS,CAC7C,MAAMC,EAAQN,EAAOF,CAAiB,EACtC,OAAI,MAAMM,CAAM,EAAUP,EAA6BC,EAAM,GAAG,GAG3DM,GAELE,EAAM,QAAQA,EAAM,QAAO,EAAKF,CAAM,EAC/BE,EACT,CCzBO,SAASC,EAAgCT,EAAM,CACpD,MAAMQ,EAAQN,EAAOF,CAAI,EACnBU,EAAU,IAAI,KAClB,KAAK,IACHF,EAAM,YAAa,EACnBA,EAAM,SAAU,EAChBA,EAAM,QAAS,EACfA,EAAM,SAAU,EAChBA,EAAM,WAAY,EAClBA,EAAM,WAAY,EAClBA,EAAM,gBAAiB,CACxB,CACF,EACD,OAAAE,EAAQ,eAAeF,EAAM,aAAa,EACnC,CAACR,EAAO,CAACU,CAClB,CC1BO,SAASC,EAAeP,KAAYQ,EAAO,CAChD,MAAMC,EAAYd,EAAc,KAC9B,KACWa,EAAM,KAAMZ,GAAS,OAAOA,GAAS,QAAQ,CACzD,EACD,O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AAKC,CACP,CAAA,CAOK,MAAO,CAEN,MAAAC,EAAY,GAAG,KAAK,SAAS,IAAI,KAAK,UAAU,IAAI,KAAK,SAAS,GAClEN,EAAa,IAAI,KAAKM,CAAS,EAInC,GAAA,CAAC5B,EAAiBsB,EAAY,CAC5B,MAAOjC,EAAW,KAAK,SAAS,EAChC,IAAKU,EAAS,KAAK,OAAO,CAAA,CAC3B,EAEK,MAAA,IAAI,MAAM,KAAK,cAAc,EAI/B,MAAA8B,EAAS,KAAK,UAAUD,CAAS,EACjCD,EAAU,KAAK,SAASL,EAAW,QAAQ,EAEjD,MAAO,CAAE,GAAGO,EAAQ,IAAKF,CAAQ,CAAA,CAErC","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9]}
package/ndc.js ADDED
@@ -0,0 +1,309 @@
1
+ var m = Object.defineProperty;
2
+ var p = (r, e, n) => e in r ? m(r, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[e] = n;
3
+ var u = (r, e, n) => p(r, typeof e != "symbol" ? e + "" : e, n);
4
+ const y = Symbol.for("constructDateFrom");
5
+ function h(r, e) {
6
+ return typeof r == "function" ? r(e) : r && typeof r == "object" && y in r ? r[y](e) : r instanceof Date ? new r.constructor(e) : new Date(e);
7
+ }
8
+ function c(r, e) {
9
+ return h(r, r);
10
+ }
11
+ function g(r, e, n) {
12
+ const a = c(r);
13
+ return isNaN(e) ? h(r, NaN) : (e && a.setDate(a.getDate() + e), a);
14
+ }
15
+ function f(r) {
16
+ const e = c(r), n = new Date(
17
+ Date.UTC(
18
+ e.getFullYear(),
19
+ e.getMonth(),
20
+ e.getDate(),
21
+ e.getHours(),
22
+ e.getMinutes(),
23
+ e.getSeconds(),
24
+ e.getMilliseconds()
25
+ )
26
+ );
27
+ return n.setUTCFullYear(e.getFullYear()), +r - +n;
28
+ }
29
+ function w(r, ...e) {
30
+ const n = h.bind(
31
+ null,
32
+ e.find((a) => typeof a == "object")
33
+ );
34
+ return e.map(n);
35
+ }
36
+ function d(r, e) {
37
+ const n = c(r);
38
+ return n.setHours(0, 0, 0, 0), n;
39
+ }
40
+ function T(r, e, n) {
41
+ const [a, o] = w(
42
+ n == null ? void 0 : n.in,
43
+ r,
44
+ e
45
+ ), s = d(a), i = d(o), D = +s - f(s), l = +i - f(i);
46
+ return Math.round((D - l) / 864e5);
47
+ }
48
+ function M(r, e) {
49
+ const n = c(r);
50
+ return n.setHours(23, 59, 59, 999), n;
51
+ }
52
+ function Y(r, e, n) {
53
+ const a = +c(r), [o, s] = [
54
+ +c(e.start),
55
+ +c(e.end)
56
+ ].sort((i, D) => i - D);
57
+ return a >= o && a <= s;
58
+ }
59
+ const t = [];
60
+ t[1975] = [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30, 365];
61
+ t[1976] = [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31, 366];
62
+ t[1977] = [30, 32, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31, 365];
63
+ t[1978] = [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30, 365];
64
+ t[1979] = t[1975];
65
+ t[1980] = t[1976];
66
+ t[1981] = [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31, 365];
67
+ t[1982] = t[1978];
68
+ t[1983] = t[1975];
69
+ t[1984] = t[1976];
70
+ t[1985] = [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30, 365];
71
+ t[1986] = t[1978];
72
+ t[1987] = [31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30, 365];
73
+ t[1988] = t[1976];
74
+ t[1989] = [31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30, 365];
75
+ t[1990] = t[1978];
76
+ t[1991] = [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30, 365];
77
+ t[1992] = [31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31, 366];
78
+ t[1993] = t[1989];
79
+ t[1994] = t[1978];
80
+ t[1995] = t[1991];
81
+ t[1996] = t[1992];
82
+ t[1997] = t[1978];
83
+ t[1998] = [31, 31, 32, 31, 32, 30, 30, 29, 30, 29, 30, 30, 365];
84
+ t[1999] = t[1976];
85
+ t[2e3] = [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31, 365];
86
+ t[2001] = t[1978];
87
+ t[2002] = t[1975];
88
+ t[2003] = t[1976];
89
+ t[2004] = t[2e3];
90
+ t[2005] = t[1978];
91
+ t[2006] = t[1975];
92
+ t[2007] = t[1976];
93
+ t[2008] = t[1981];
94
+ t[2009] = t[1978];
95
+ t[2010] = t[1975];
96
+ t[2011] = t[1976];
97
+ t[2012] = t[1985];
98
+ t[2013] = t[1978];
99
+ t[2014] = t[1975];
100
+ t[2015] = t[1976];
101
+ t[2016] = t[1985];
102
+ t[2017] = t[1978];
103
+ t[2018] = t[1987];
104
+ t[2019] = t[1992];
105
+ t[2020] = t[1989];
106
+ t[2021] = t[1978];
107
+ t[2022] = t[1991];
108
+ t[2023] = t[1992];
109
+ t[2024] = t[1989];
110
+ t[2025] = t[1978];
111
+ t[2026] = t[1976];
112
+ t[2027] = t[2e3];
113
+ t[2028] = t[1978];
114
+ t[2029] = t[1998];
115
+ t[2030] = t[1976];
116
+ t[2031] = t[2e3];
117
+ t[2032] = t[1978];
118
+ t[2033] = t[1975];
119
+ t[2034] = t[1976];
120
+ t[2035] = t[1977];
121
+ t[2036] = t[1978];
122
+ t[2037] = t[1975];
123
+ t[2038] = t[1976];
124
+ t[2039] = t[1985];
125
+ t[2040] = t[1978];
126
+ t[2041] = t[1975];
127
+ t[2042] = t[1976];
128
+ t[2043] = t[1985];
129
+ t[2044] = t[1978];
130
+ t[2045] = t[1987];
131
+ t[2046] = t[1976];
132
+ t[2047] = t[1989];
133
+ t[2048] = t[1978];
134
+ t[2049] = t[1991];
135
+ t[2050] = t[1992];
136
+ t[2051] = t[1989];
137
+ t[2052] = t[1978];
138
+ t[2053] = t[1991];
139
+ t[2054] = t[1992];
140
+ t[2055] = t[1978];
141
+ t[2056] = t[1998];
142
+ t[2057] = t[1976];
143
+ t[2058] = t[2e3];
144
+ t[2059] = t[1978];
145
+ t[2060] = t[1975];
146
+ t[2061] = t[1976];
147
+ t[2062] = [30, 32, 31, 32, 31, 31, 29, 30, 29, 30, 29, 31, 365];
148
+ t[2063] = t[1978];
149
+ t[2064] = t[1975];
150
+ t[2065] = t[1976];
151
+ t[2066] = t[1981];
152
+ t[2067] = t[1978];
153
+ t[2068] = t[1975];
154
+ t[2069] = t[1976];
155
+ t[2070] = t[1985];
156
+ t[2071] = t[1978];
157
+ t[2072] = t[1987];
158
+ t[2073] = t[1976];
159
+ t[2074] = t[1989];
160
+ t[2075] = t[1978];
161
+ t[2076] = t[1991];
162
+ t[2077] = t[1992];
163
+ t[2078] = t[1989];
164
+ t[2079] = t[1978];
165
+ t[2080] = t[1991];
166
+ t[2081] = t[1992];
167
+ t[2082] = t[1989];
168
+ t[2083] = t[1978];
169
+ t[2084] = t[1976];
170
+ t[2085] = t[2e3];
171
+ t[2086] = t[1978];
172
+ t[2087] = t[1975];
173
+ t[2088] = t[1976];
174
+ t[2089] = t[2e3];
175
+ t[2090] = t[1978];
176
+ t[2091] = t[1975];
177
+ t[2092] = t[1976];
178
+ t[2093] = t[1981];
179
+ t[2094] = t[1978];
180
+ t[2095] = t[1975];
181
+ t[2096] = t[1976];
182
+ t[2097] = t[1985];
183
+ t[2098] = t[1978];
184
+ t[2099] = t[1975];
185
+ class E {
186
+ constructor(e) {
187
+ // Supported date range for the Nepali calendar (1975 BS - 2099 BS)
188
+ u(this, "startDate", /* @__PURE__ */ new Date("1918-04-13"));
189
+ // 1975-01-01 BS
190
+ u(this, "endDate", /* @__PURE__ */ new Date("2043-04-13"));
191
+ // 2099-12-30 BS
192
+ u(this, "dateRangeError", "The input date is out of supported range.");
193
+ // Extracted values from the input date string
194
+ u(this, "inputYear");
195
+ u(this, "inputMonth");
196
+ u(this, "inputDate");
197
+ const [n, a, o] = this.parseDateString(e);
198
+ this.inputYear = n, this.inputMonth = a, this.inputDate = o;
199
+ }
200
+ /**
201
+ * Parses and cleans the input date string.
202
+ * Converts Nepali numerals to English and splits into year, month, and date.
203
+ */
204
+ parseDateString(e) {
205
+ const n = this.numToEn(e).replace(/[./|,]/g, "-").trim(), [a, o, s] = n.split("-").map(Number);
206
+ return [a, o, s];
207
+ }
208
+ /**
209
+ * Converts Nepali numerals (०-९) to English numerals (0-9).
210
+ */
211
+ numToEn(e) {
212
+ const n = ["०", "१", "२", "३", "४", "५", "६", "७", "८", "९"];
213
+ return e.replace(
214
+ /[०१२३४५६७८९]/g,
215
+ (a) => n.indexOf(a).toString()
216
+ );
217
+ }
218
+ /**
219
+ * Converts a day index (0-6) to a day name (Sunday-Saturday).
220
+ */
221
+ numToDay(e) {
222
+ return [
223
+ "Sunday",
224
+ "Monday",
225
+ "Tuesday",
226
+ "Wednesday",
227
+ "Thursday",
228
+ "Friday",
229
+ "Saturday"
230
+ ][e];
231
+ }
232
+ /**
233
+ * Calculates the AD date for a given BS date.
234
+ * Uses the total days difference from the start date (1975-01-01 BS).
235
+ */
236
+ getAdDate(e, n, a) {
237
+ let o = 0;
238
+ for (let s = 1975; s < e; s++)
239
+ o += t[s][12];
240
+ for (let s = 0; s < n - 1; s++)
241
+ o += t[e][s];
242
+ return o += a - 1, g(this.startDate, o);
243
+ }
244
+ /**
245
+ * Calculates the BS date for a given AD date.
246
+ * Uses the total days difference from the start date (1975-01-01 BS).
247
+ */
248
+ getBsDate(e) {
249
+ const n = new Date(e);
250
+ let a = T(n, this.startDate);
251
+ for (const o in t) {
252
+ const s = t[o][12];
253
+ if (a >= s) {
254
+ a -= s;
255
+ continue;
256
+ }
257
+ for (let i = 0; i < 12; i++) {
258
+ const D = t[o][i];
259
+ if (a >= D) {
260
+ a -= D;
261
+ continue;
262
+ }
263
+ return {
264
+ year: Number(o),
265
+ month: i + 1,
266
+ date: a + 1
267
+ };
268
+ }
269
+ }
270
+ throw new Error(this.dateRangeError);
271
+ }
272
+ /**
273
+ * Converts the input BS date to an AD date.
274
+ * Returns an object with year, month, date, and day.
275
+ */
276
+ toAd() {
277
+ if (this.inputYear < 1975 || this.inputYear > 2099)
278
+ throw new Error(this.dateRangeError);
279
+ const e = this.getAdDate(
280
+ this.inputYear,
281
+ this.inputMonth,
282
+ this.inputDate
283
+ ), n = this.numToDay(e.getDay());
284
+ return {
285
+ year: e.getFullYear(),
286
+ month: e.getMonth() + 1,
287
+ date: e.getDate(),
288
+ day: n
289
+ };
290
+ }
291
+ /**
292
+ * Converts the input AD date to a BS date.
293
+ * Returns an object with year, month, date, and day.
294
+ */
295
+ toBs() {
296
+ const e = `${this.inputYear}-${this.inputMonth}-${this.inputDate}`, n = new Date(e);
297
+ if (!Y(n, {
298
+ start: d(this.startDate),
299
+ end: M(this.endDate)
300
+ }))
301
+ throw new Error(this.dateRangeError);
302
+ const a = this.getBsDate(e), o = this.numToDay(n.getDay());
303
+ return { ...a, day: o };
304
+ }
305
+ }
306
+ export {
307
+ E as default
308
+ };
309
+ //# sourceMappingURL=ndc.js.map
package/ndc.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ndc.js","sources":["../node_modules/date-fns/constants.js","../node_modules/date-fns/constructFrom.js","../node_modules/date-fns/toDate.js","../node_modules/date-fns/addDays.js","../node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js","../node_modules/date-fns/_lib/normalizeDates.js","../node_modules/date-fns/startOfDay.js","../node_modules/date-fns/differenceInCalendarDays.js","../node_modules/date-fns/endOfDay.js","../node_modules/date-fns/isWithinInterval.js","../src/years.ts","../src/index.ts"],"sourcesContent":["/**\n * @module constants\n * @summary Useful constants\n * @description\n * Collection of useful date constants.\n *\n * The constants could be imported from `date-fns/constants`:\n *\n * ```ts\n * import { maxTime, minTime } from \"./constants/date-fns/constants\";\n *\n * function isAllowedTime(time) {\n * return time <= maxTime && time >= minTime;\n * }\n * ```\n */\n\n/**\n * @constant\n * @name daysInWeek\n * @summary Days in 1 week.\n */\nexport const daysInWeek = 7;\n\n/**\n * @constant\n * @name daysInYear\n * @summary Days in 1 year.\n *\n * @description\n * How many days in a year.\n *\n * One years equals 365.2425 days according to the formula:\n *\n * > Leap year occurs every 4 years, except for years that are divisible by 100 and not divisible by 400.\n * > 1 mean year = (365+1/4-1/100+1/400) days = 365.2425 days\n */\nexport const daysInYear = 365.2425;\n\n/**\n * @constant\n * @name maxTime\n * @summary Maximum allowed time.\n *\n * @example\n * import { maxTime } from \"./constants/date-fns/constants\";\n *\n * const isValid = 8640000000000001 <= maxTime;\n * //=> false\n *\n * new Date(8640000000000001);\n * //=> Invalid Date\n */\nexport const maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1000;\n\n/**\n * @constant\n * @name minTime\n * @summary Minimum allowed time.\n *\n * @example\n * import { minTime } from \"./constants/date-fns/constants\";\n *\n * const isValid = -8640000000000001 >= minTime;\n * //=> false\n *\n * new Date(-8640000000000001)\n * //=> Invalid Date\n */\nexport const minTime = -maxTime;\n\n/**\n * @constant\n * @name millisecondsInWeek\n * @summary Milliseconds in 1 week.\n */\nexport const millisecondsInWeek = 604800000;\n\n/**\n * @constant\n * @name millisecondsInDay\n * @summary Milliseconds in 1 day.\n */\nexport const millisecondsInDay = 86400000;\n\n/**\n * @constant\n * @name millisecondsInMinute\n * @summary Milliseconds in 1 minute\n */\nexport const millisecondsInMinute = 60000;\n\n/**\n * @constant\n * @name millisecondsInHour\n * @summary Milliseconds in 1 hour\n */\nexport const millisecondsInHour = 3600000;\n\n/**\n * @constant\n * @name millisecondsInSecond\n * @summary Milliseconds in 1 second\n */\nexport const millisecondsInSecond = 1000;\n\n/**\n * @constant\n * @name minutesInYear\n * @summary Minutes in 1 year.\n */\nexport const minutesInYear = 525600;\n\n/**\n * @constant\n * @name minutesInMonth\n * @summary Minutes in 1 month.\n */\nexport const minutesInMonth = 43200;\n\n/**\n * @constant\n * @name minutesInDay\n * @summary Minutes in 1 day.\n */\nexport const minutesInDay = 1440;\n\n/**\n * @constant\n * @name minutesInHour\n * @summary Minutes in 1 hour.\n */\nexport const minutesInHour = 60;\n\n/**\n * @constant\n * @name monthsInQuarter\n * @summary Months in 1 quarter.\n */\nexport const monthsInQuarter = 3;\n\n/**\n * @constant\n * @name monthsInYear\n * @summary Months in 1 year.\n */\nexport const monthsInYear = 12;\n\n/**\n * @constant\n * @name quartersInYear\n * @summary Quarters in 1 year\n */\nexport const quartersInYear = 4;\n\n/**\n * @constant\n * @name secondsInHour\n * @summary Seconds in 1 hour.\n */\nexport const secondsInHour = 3600;\n\n/**\n * @constant\n * @name secondsInMinute\n * @summary Seconds in 1 minute.\n */\nexport const secondsInMinute = 60;\n\n/**\n * @constant\n * @name secondsInDay\n * @summary Seconds in 1 day.\n */\nexport const secondsInDay = secondsInHour * 24;\n\n/**\n * @constant\n * @name secondsInWeek\n * @summary Seconds in 1 week.\n */\nexport const secondsInWeek = secondsInDay * 7;\n\n/**\n * @constant\n * @name secondsInYear\n * @summary Seconds in 1 year.\n */\nexport const secondsInYear = secondsInDay * daysInYear;\n\n/**\n * @constant\n * @name secondsInMonth\n * @summary Seconds in 1 month\n */\nexport const secondsInMonth = secondsInYear / 12;\n\n/**\n * @constant\n * @name secondsInQuarter\n * @summary Seconds in 1 quarter.\n */\nexport const secondsInQuarter = secondsInMonth * 3;\n\n/**\n * @constant\n * @name constructFromSymbol\n * @summary Symbol enabling Date extensions to inherit properties from the reference date.\n *\n * The symbol is used to enable the `constructFrom` function to construct a date\n * using a reference date and a value. It allows to transfer extra properties\n * from the reference date to the new date. It's useful for extensions like\n * [`TZDate`](https://github.com/date-fns/tz) that accept a time zone as\n * a constructor argument.\n */\nexport const constructFromSymbol = Symbol.for(\"constructDateFrom\");\n","import { constructFromSymbol } from \"./constants.js\";\n\n/**\n * @name constructFrom\n * @category Generic Helpers\n * @summary Constructs a date using the reference date and the value\n *\n * @description\n * The function constructs a new date using the constructor from the reference\n * date and the given value. It helps to build generic functions that accept\n * date extensions.\n *\n * It defaults to `Date` if the passed reference date is a number or a string.\n *\n * Starting from v3.7.0, it allows to construct a date using `[Symbol.for(\"constructDateFrom\")]`\n * enabling to transfer extra properties from the reference date to the new date.\n * It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz)\n * that accept a time zone as a constructor argument.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n *\n * @param date - The reference date to take constructor from\n * @param value - The value to create the date\n *\n * @returns Date initialized using the given date and value\n *\n * @example\n * import { constructFrom } from \"./constructFrom/date-fns\";\n *\n * // A function that clones a date preserving the original type\n * function cloneDate<DateType extends Date>(date: DateType): DateType {\n * return constructFrom(\n * date, // Use constructor from the given date\n * date.getTime() // Use the date value to create a new date\n * );\n * }\n */\nexport function constructFrom(date, value) {\n if (typeof date === \"function\") return date(value);\n\n if (date && typeof date === \"object\" && constructFromSymbol in date)\n return date[constructFromSymbol](value);\n\n if (date instanceof Date) return new date.constructor(value);\n\n return new Date(value);\n}\n\n// Fallback for modularized imports:\nexport default constructFrom;\n","import { constructFrom } from \"./constructFrom.js\";\n\n/**\n * @name toDate\n * @category Common Helpers\n * @summary Convert the given argument to an instance of Date.\n *\n * @description\n * Convert the given argument to an instance of Date.\n *\n * If the argument is an instance of Date, the function returns its clone.\n *\n * If the argument is a number, it is treated as a timestamp.\n *\n * If the argument is none of the above, the function returns Invalid Date.\n *\n * Starting from v3.7.0, it clones a date using `[Symbol.for(\"constructDateFrom\")]`\n * enabling to transfer extra properties from the reference date to the new date.\n * It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz)\n * that accept a time zone as a constructor argument.\n *\n * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param argument - The value to convert\n *\n * @returns The parsed date in the local time zone\n *\n * @example\n * // Clone the date:\n * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))\n * //=> Tue Feb 11 2014 11:30:30\n *\n * @example\n * // Convert the timestamp to date:\n * const result = toDate(1392098430000)\n * //=> Tue Feb 11 2014 11:30:30\n */\nexport function toDate(argument, context) {\n // [TODO] Get rid of `toDate` or `constructFrom`?\n return constructFrom(context || argument, argument);\n}\n\n// Fallback for modularized imports:\nexport default toDate;\n","import { constructFrom } from \"./constructFrom.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link addDays} function options.\n */\n\n/**\n * @name addDays\n * @category Day Helpers\n * @summary Add the specified number of days to the given date.\n *\n * @description\n * Add the specified number of days to the given date.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The date to be changed\n * @param amount - The amount of days to be added.\n * @param options - An object with options\n *\n * @returns The new date with the days added\n *\n * @example\n * // Add 10 days to 1 September 2014:\n * const result = addDays(new Date(2014, 8, 1), 10)\n * //=> Thu Sep 11 2014 00:00:00\n */\nexport function addDays(date, amount, options) {\n const _date = toDate(date, options?.in);\n if (isNaN(amount)) return constructFrom(options?.in || date, NaN);\n\n // If 0 days, no-op to avoid changing times in the hour before end of DST\n if (!amount) return _date;\n\n _date.setDate(_date.getDate() + amount);\n return _date;\n}\n\n// Fallback for modularized imports:\nexport default addDays;\n","import { toDate } from \"../toDate.js\";\n\n/**\n * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.\n * They usually appear for dates that denote time before the timezones were introduced\n * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891\n * and GMT+01:00:00 after that date)\n *\n * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,\n * which would lead to incorrect calculations.\n *\n * This function returns the timezone offset in milliseconds that takes seconds in account.\n */\nexport function getTimezoneOffsetInMilliseconds(date) {\n const _date = toDate(date);\n const utcDate = new Date(\n Date.UTC(\n _date.getFullYear(),\n _date.getMonth(),\n _date.getDate(),\n _date.getHours(),\n _date.getMinutes(),\n _date.getSeconds(),\n _date.getMilliseconds(),\n ),\n );\n utcDate.setUTCFullYear(_date.getFullYear());\n return +date - +utcDate;\n}\n","import { constructFrom } from \"../constructFrom.js\";\n\nexport function normalizeDates(context, ...dates) {\n const normalize = constructFrom.bind(\n null,\n context || dates.find((date) => typeof date === \"object\"),\n );\n return dates.map(normalize);\n}\n","import { toDate } from \"./toDate.js\";\n\n/**\n * The {@link startOfDay} function options.\n */\n\n/**\n * @name startOfDay\n * @category Day Helpers\n * @summary Return the start of a day for the given date.\n *\n * @description\n * Return the start of a day for the given date.\n * The result will be in the local timezone.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The original date\n * @param options - The options\n *\n * @returns The start of a day\n *\n * @example\n * // The start of a day for 2 September 2014 11:55:00:\n * const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Tue Sep 02 2014 00:00:00\n */\nexport function startOfDay(date, options) {\n const _date = toDate(date, options?.in);\n _date.setHours(0, 0, 0, 0);\n return _date;\n}\n\n// Fallback for modularized imports:\nexport default startOfDay;\n","import { getTimezoneOffsetInMilliseconds } from \"./_lib/getTimezoneOffsetInMilliseconds.js\";\nimport { normalizeDates } from \"./_lib/normalizeDates.js\";\nimport { millisecondsInDay } from \"./constants.js\";\nimport { startOfDay } from \"./startOfDay.js\";\n\n/**\n * The {@link differenceInCalendarDays} function options.\n */\n\n/**\n * @name differenceInCalendarDays\n * @category Day Helpers\n * @summary Get the number of calendar days between the given dates.\n *\n * @description\n * Get the number of calendar days between the given dates. This means that the times are removed\n * from the dates and then the difference in days is calculated.\n *\n * @param laterDate - The later date\n * @param earlierDate - The earlier date\n * @param options - The options object\n *\n * @returns The number of calendar days\n *\n * @example\n * // How many calendar days are between\n * // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?\n * const result = differenceInCalendarDays(\n * new Date(2012, 6, 2, 0, 0),\n * new Date(2011, 6, 2, 23, 0)\n * )\n * //=> 366\n * // How many calendar days are between\n * // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?\n * const result = differenceInCalendarDays(\n * new Date(2011, 6, 3, 0, 1),\n * new Date(2011, 6, 2, 23, 59)\n * )\n * //=> 1\n */\nexport function differenceInCalendarDays(laterDate, earlierDate, options) {\n const [laterDate_, earlierDate_] = normalizeDates(\n options?.in,\n laterDate,\n earlierDate,\n );\n\n const laterStartOfDay = startOfDay(laterDate_);\n const earlierStartOfDay = startOfDay(earlierDate_);\n\n const laterTimestamp =\n +laterStartOfDay - getTimezoneOffsetInMilliseconds(laterStartOfDay);\n const earlierTimestamp =\n +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay);\n\n // Round the number of days to the nearest integer because the number of\n // milliseconds in a day is not constant (e.g. it's different in the week of\n // the daylight saving time clock shift).\n return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay);\n}\n\n// Fallback for modularized imports:\nexport default differenceInCalendarDays;\n","import { toDate } from \"./toDate.js\";\n\n/**\n * The {@link endOfDay} function options.\n */\n\n/**\n * @name endOfDay\n * @category Day Helpers\n * @summary Return the end of a day for the given date.\n *\n * @description\n * Return the end of a day for the given date.\n * The result will be in the local timezone.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The original date\n * @param options - An object with options\n *\n * @returns The end of a day\n *\n * @example\n * // The end of a day for 2 September 2014 11:55:00:\n * const result = endOfDay(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Tue Sep 02 2014 23:59:59.999\n */\nexport function endOfDay(date, options) {\n const _date = toDate(date, options?.in);\n _date.setHours(23, 59, 59, 999);\n return _date;\n}\n\n// Fallback for modularized imports:\nexport default endOfDay;\n","import { toDate } from \"./toDate.js\";\n\n/**\n * The {@link isWithinInterval} function options.\n */\n\n/**\n * @name isWithinInterval\n * @category Interval Helpers\n * @summary Is the given date within the interval?\n *\n * @description\n * Is the given date within the interval? (Including start and end.)\n *\n * @param date - The date to check\n * @param interval - The interval to check\n * @param options - An object with options\n *\n * @returns The date is within the interval\n *\n * @example\n * // For the date within the interval:\n * isWithinInterval(new Date(2014, 0, 3), {\n * start: new Date(2014, 0, 1),\n * end: new Date(2014, 0, 7)\n * })\n * // => true\n *\n * @example\n * // For the date outside of the interval:\n * isWithinInterval(new Date(2014, 0, 10), {\n * start: new Date(2014, 0, 1),\n * end: new Date(2014, 0, 7)\n * })\n * // => false\n *\n * @example\n * // For date equal to the interval start:\n * isWithinInterval(date, { start, end: date })\n * // => true\n *\n * @example\n * // For date equal to the interval end:\n * isWithinInterval(date, { start: date, end })\n * // => true\n */\nexport function isWithinInterval(date, interval, options) {\n const time = +toDate(date, options?.in);\n const [startTime, endTime] = [\n +toDate(interval.start, options?.in),\n +toDate(interval.end, options?.in),\n ].sort((a, b) => a - b);\n\n return time >= startTime && time <= endTime;\n}\n\n// Fallback for modularized imports:\nexport default isWithinInterval;\n","/**\n * The Nepali calendar data from 1975 BS to 2099 BS.\n * Based on the array index months days (0 → 11th), total days in year (12th)\n */\nconst years: number[][] = [];\n// fill years and their months\nyears[1975] = [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30, 365];\nyears[1976] = [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31, 366];\nyears[1977] = [30, 32, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31, 365];\nyears[1978] = [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30, 365];\nyears[1979] = years[1975];\nyears[1980] = years[1976];\nyears[1981] = [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31, 365];\nyears[1982] = years[1978];\nyears[1983] = years[1975];\nyears[1984] = years[1976];\nyears[1985] = [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30, 365];\nyears[1986] = years[1978];\nyears[1987] = [31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30, 365];\nyears[1988] = years[1976];\nyears[1989] = [31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30, 365];\nyears[1990] = years[1978];\nyears[1991] = [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30, 365];\nyears[1992] = [31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31, 366];\nyears[1993] = years[1989];\nyears[1994] = years[1978];\nyears[1995] = years[1991];\nyears[1996] = years[1992];\nyears[1997] = years[1978];\nyears[1998] = [31, 31, 32, 31, 32, 30, 30, 29, 30, 29, 30, 30, 365];\nyears[1999] = years[1976];\nyears[2000] = [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31, 365];\nyears[2001] = years[1978];\nyears[2002] = years[1975];\nyears[2003] = years[1976];\nyears[2004] = years[2000];\nyears[2005] = years[1978];\nyears[2006] = years[1975];\nyears[2007] = years[1976];\nyears[2008] = years[1981];\nyears[2009] = years[1978];\nyears[2010] = years[1975];\nyears[2011] = years[1976];\nyears[2012] = years[1985];\nyears[2013] = years[1978];\nyears[2014] = years[1975];\nyears[2015] = years[1976];\nyears[2016] = years[1985];\nyears[2017] = years[1978];\nyears[2018] = years[1987];\nyears[2019] = years[1992];\nyears[2020] = years[1989];\nyears[2021] = years[1978];\nyears[2022] = years[1991];\nyears[2023] = years[1992];\nyears[2024] = years[1989];\nyears[2025] = years[1978];\nyears[2026] = years[1976];\nyears[2027] = years[2000];\nyears[2028] = years[1978];\nyears[2029] = years[1998];\nyears[2030] = years[1976];\nyears[2031] = years[2000];\nyears[2032] = years[1978];\nyears[2033] = years[1975];\nyears[2034] = years[1976];\nyears[2035] = years[1977];\nyears[2036] = years[1978];\nyears[2037] = years[1975];\nyears[2038] = years[1976];\nyears[2039] = years[1985];\nyears[2040] = years[1978];\nyears[2041] = years[1975];\nyears[2042] = years[1976];\nyears[2043] = years[1985];\nyears[2044] = years[1978];\nyears[2045] = years[1987];\nyears[2046] = years[1976];\nyears[2047] = years[1989];\nyears[2048] = years[1978];\nyears[2049] = years[1991];\nyears[2050] = years[1992];\nyears[2051] = years[1989];\nyears[2052] = years[1978];\nyears[2053] = years[1991];\nyears[2054] = years[1992];\nyears[2055] = years[1978];\nyears[2056] = years[1998];\nyears[2057] = years[1976];\nyears[2058] = years[2000];\nyears[2059] = years[1978];\nyears[2060] = years[1975];\nyears[2061] = years[1976];\nyears[2062] = [30, 32, 31, 32, 31, 31, 29, 30, 29, 30, 29, 31, 365];\nyears[2063] = years[1978];\nyears[2064] = years[1975];\nyears[2065] = years[1976];\nyears[2066] = years[1981];\nyears[2067] = years[1978];\nyears[2068] = years[1975];\nyears[2069] = years[1976];\nyears[2070] = years[1985];\nyears[2071] = years[1978];\nyears[2072] = years[1987];\nyears[2073] = years[1976];\nyears[2074] = years[1989];\nyears[2075] = years[1978];\nyears[2076] = years[1991];\nyears[2077] = years[1992];\nyears[2078] = years[1989];\nyears[2079] = years[1978];\nyears[2080] = years[1991];\nyears[2081] = years[1992];\nyears[2082] = years[1989];\nyears[2083] = years[1978];\nyears[2084] = years[1976];\nyears[2085] = years[2000];\nyears[2086] = years[1978];\nyears[2087] = years[1975];\nyears[2088] = years[1976];\nyears[2089] = years[2000];\nyears[2090] = years[1978];\nyears[2091] = years[1975];\nyears[2092] = years[1976];\nyears[2093] = years[1981];\nyears[2094] = years[1978];\nyears[2095] = years[1975];\nyears[2096] = years[1976];\nyears[2097] = years[1985];\nyears[2098] = years[1978];\nyears[2099] = years[1975];\n\n// export years data\nexport { years };\n","import {\n addDays,\n differenceInCalendarDays,\n endOfDay,\n isWithinInterval,\n startOfDay,\n} from 'date-fns';\n\nimport { years } from './years';\n\nexport default class DateConverter {\n // Supported date range for the Nepali calendar (1975 BS - 2099 BS)\n private readonly startDate = new Date('1918-04-13'); // 1975-01-01 BS\n private readonly endDate = new Date('2043-04-13'); // 2099-12-30 BS\n private readonly dateRangeError = 'The input date is out of supported range.';\n\n // Extracted values from the input date string\n private readonly inputYear: number;\n private readonly inputMonth: number;\n private readonly inputDate: number;\n\n constructor(strDate: string) {\n // Parse and clean the input date string\n const [year, month, date] = this.parseDateString(strDate);\n this.inputYear = year;\n this.inputMonth = month;\n this.inputDate = date;\n }\n\n /**\n * Parses and cleans the input date string.\n * Converts Nepali numerals to English and splits into year, month, and date.\n */\n private parseDateString(strDate: string): [number, number, number] {\n const cleanedDate = this.numToEn(strDate)\n .replace(/[./|,]/g, '-')\n .trim();\n const [year, month, date] = cleanedDate.split('-').map(Number);\n\n return [year, month, date];\n }\n\n /**\n * Converts Nepali numerals (०-९) to English numerals (0-9).\n */\n private numToEn(strNum: string): string {\n const nepaliNumerals = ['०', '१', '२', '३', '४', '५', '६', '७', '८', '९'];\n\n return strNum.replace(/[०१२३४५६७८९]/g, (char) =>\n nepaliNumerals.indexOf(char).toString(),\n );\n }\n\n /**\n * Converts a day index (0-6) to a day name (Sunday-Saturday).\n */\n private numToDay(dayIndex: number): string {\n const days = [\n 'Sunday',\n 'Monday',\n 'Tuesday',\n 'Wednesday',\n 'Thursday',\n 'Friday',\n 'Saturday',\n ];\n\n return days[dayIndex];\n }\n\n /**\n * Calculates the AD date for a given BS date.\n * Uses the total days difference from the start date (1975-01-01 BS).\n */\n private getAdDate(year: number, month: number, date: number): Date {\n let totalDays = 0;\n\n // Add days for each year before the input year\n for (let y = 1975; y < year; y++) {\n totalDays += years[y][12]; // daysInYear is stored at index 12\n }\n\n // Add days for each month before the input month\n for (let m = 0; m < month - 1; m++) {\n totalDays += years[year][m];\n }\n\n // Add days for the current month\n totalDays += date - 1; // Subtract 1 to exclude the current day\n\n return addDays(this.startDate, totalDays);\n }\n\n /**\n * Calculates the BS date for a given AD date.\n * Uses the total days difference from the start date (1975-01-01 BS).\n */\n private getBsDate(givenDate: string): {\n year: number;\n month: number;\n date: number;\n } {\n const targetDate = new Date(givenDate);\n let remainingDays = differenceInCalendarDays(targetDate, this.startDate);\n\n // Iterate through years and months to find the BS date\n for (const year in years) {\n const daysInYear = years[year][12];\n\n if (remainingDays >= daysInYear) {\n remainingDays -= daysInYear;\n continue;\n }\n\n for (let month = 0; month < 12; month++) {\n const daysInMonth = years[year][month];\n\n if (remainingDays >= daysInMonth) {\n remainingDays -= daysInMonth;\n continue;\n }\n\n // Return the calculated BS date\n return {\n year: Number(year),\n month: month + 1,\n date: remainingDays + 1,\n };\n }\n }\n\n throw new Error(this.dateRangeError);\n }\n\n /**\n * Converts the input BS date to an AD date.\n * Returns an object with year, month, date, and day.\n */\n public toAd() {\n // Validate the input year range\n if (this.inputYear < 1975 || this.inputYear > 2099) {\n throw new Error(this.dateRangeError);\n }\n\n // Calculate the AD date and weekday\n const adDate = this.getAdDate(\n this.inputYear,\n this.inputMonth,\n this.inputDate,\n );\n const weekday = this.numToDay(adDate.getDay());\n\n return {\n year: adDate.getFullYear(),\n month: adDate.getMonth() + 1,\n date: adDate.getDate(),\n day: weekday,\n };\n }\n\n /**\n * Converts the input AD date to a BS date.\n * Returns an object with year, month, date, and day.\n */\n public toBs() {\n // Format the input date string\n const inputDate = `${this.inputYear}-${this.inputMonth}-${this.inputDate}`;\n const targetDate = new Date(inputDate);\n\n // Validate the input date range\n if (\n !isWithinInterval(targetDate, {\n start: startOfDay(this.startDate),\n end: endOfDay(this.endDate),\n })\n ) {\n throw new Error(this.dateRangeError);\n }\n\n // Calculate the BS date and weekday\n const bsDate = this.getBsDate(inputDate);\n const weekday = this.numToDay(targetDate.getDay());\n\n return { ...bsDate, day: weekday };\n }\n}\n"],"names":["constructFromSymbol","constructFrom","date","value","toDate","argument","context","addDays","amount","options","_date","getTimezoneOffsetInMilliseconds","utcDate","normalizeDates","dates","normalize","startOfDay","differenceInCalendarDays","laterDate","earlierDate","laterDate_","earlierDate_","laterStartOfDay","earlierStartOfDay","laterTimestamp","earlierTimestamp","endOfDay","isWithinInterval","interval","time","startTime","endTime","a","b","years","DateConverter","strDate","__publicField","year","month","cleanedDate","strNum","nepaliNumerals","char","dayIndex","totalDays","y","m","givenDate","targetDate","remainingDays","daysInYear","daysInMonth","adDate","weekday","inputDate","bsDate"],"mappings":";;;AAuNO,MAAMA,IAAsB,OAAO,IAAI,mBAAmB;AClL1D,SAASC,EAAcC,GAAMC,GAAO;AACzC,SAAI,OAAOD,KAAS,aAAmBA,EAAKC,CAAK,IAE7CD,KAAQ,OAAOA,KAAS,YAAYF,KAAuBE,IACtDA,EAAKF,CAAmB,EAAEG,CAAK,IAEpCD,aAAgB,OAAa,IAAIA,EAAK,YAAYC,CAAK,IAEpD,IAAI,KAAKA,CAAK;AACvB;ACNO,SAASC,EAAOC,GAAUC,GAAS;AAExC,SAAOL,EAAyBI,GAAUA,CAAQ;AACpD;ACdO,SAASE,EAAQL,GAAMM,GAAQC,GAAS;AAC7C,QAAMC,IAAQN,EAAOF,CAAiB;AACtC,SAAI,MAAMM,CAAM,IAAUP,EAA6BC,GAAM,GAAG,KAG3DM,KAELE,EAAM,QAAQA,EAAM,QAAO,IAAKF,CAAM,GAC/BE;AACT;ACzBO,SAASC,EAAgCT,GAAM;AACpD,QAAMQ,IAAQN,EAAOF,CAAI,GACnBU,IAAU,IAAI;AAAA,IAClB,KAAK;AAAA,MACHF,EAAM,YAAa;AAAA,MACnBA,EAAM,SAAU;AAAA,MAChBA,EAAM,QAAS;AAAA,MACfA,EAAM,SAAU;AAAA,MAChBA,EAAM,WAAY;AAAA,MAClBA,EAAM,WAAY;AAAA,MAClBA,EAAM,gBAAiB;AAAA,IACxB;AAAA,EACF;AACD,SAAAE,EAAQ,eAAeF,EAAM,aAAa,GACnC,CAACR,IAAO,CAACU;AAClB;AC1BO,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erge/nepali-date-converter",
3
+ "version": "1.0.0",
4
+ "description": "A modern JavaScript library for seamless conversion between Bikram Sambat (BS) and Gregorian (AD) dates. Easily convert Nepali dates to English dates and vice versa with support for years 1975 BS to 2099 BS.",
5
+ "license": "MIT",
6
+ "author": {
7
+ "name": "Madan Sapkota",
8
+ "role": "Maintainer",
9
+ "email": "contact+github@madansapkota.com",
10
+ "url": "https://madansapkota.com"
11
+ },
12
+ "homepage": "https://madansapkota.com",
13
+ "keywords": [
14
+ "ad-to-bs",
15
+ "bikram-sambat",
16
+ "bs-to-ad",
17
+ "date-conversion",
18
+ "miti-pariwartan",
19
+ "nepali-calendar",
20
+ "nepali-date",
21
+ "nepali-date-converter",
22
+ "nepali-date-formatter",
23
+ "nepali-date-library",
24
+ "nepali-date-tool",
25
+ "nepali-date-utility",
26
+ "nepali-miti"
27
+ ],
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "git+https://github.com/remotemerge/nepali-date-converter.git"
31
+ },
32
+ "bugs": {
33
+ "url": "https://github.com/remotemerge/nepali-date-converter/issues"
34
+ },
35
+ "type": "module",
36
+ "types": "./index.d.ts",
37
+ "module": "./ndc.js",
38
+ "main": "./ndc-node.js",
39
+ "exports": {
40
+ ".": {
41
+ "import": "./ndc.js",
42
+ "require": "./ndc-node.js"
43
+ }
44
+ },
45
+ "files": [
46
+ "**/*"
47
+ ],
48
+ "engines": {
49
+ "node": ">=18.0.0"
50
+ },
51
+ "scripts": {
52
+ "start": "echo \"Thanks for using the package 🎉🎉🎉\"",
53
+ "test": "echo \"Error: no test specified\" && exit 1"
54
+ }
55
+ }
package/years.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ declare const years: number[][];
2
+ export { years };