Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: dates fixed for 2081 and dates added upto 2100 BS. #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/NepaliDate.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,4 +176,4 @@ NepaliDate.minimum = () => new Date(EPOCH);
NepaliDate.maximum = () => new Date(EPOCH
+ ((NEPALI_DATE_MAP[NEPALI_DATE_MAP.length - 1][SUM_IDX]) * 86400000));

export default NepaliDate;
export default NepaliDate;
30 changes: 21 additions & 9 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,29 @@ exports.NEPALI_DATE_MAP = [
[2078, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30, 365],
[2079, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30, 365],
[2080, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30, 365],
[2081, 31, 31, 32, 32, 31, 30, 30, 30, 29, 30, 30, 30, 366],
[2082, 30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 30, 30, 365],
[2083, 31, 31, 32, 31, 31, 30, 30, 30, 29, 30, 30, 30, 365],
[2084, 31, 31, 32, 31, 31, 30, 30, 30, 29, 30, 30, 30, 365],
[2085, 31, 32, 31, 32, 30, 31, 30, 30, 29, 30, 30, 30, 366],
[2086, 30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 30, 30, 365],
[2087, 31, 31, 32, 31, 31, 31, 30, 30, 29, 30, 30, 30, 366],
[2088, 30, 31, 32, 32, 30, 31, 30, 30, 29, 30, 30, 30, 365],
[2081, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31, 366],
[2082, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30, 365],
[2083, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30, 365],
[2084, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31, 366],
[2085, 30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31, 365],
[2086, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30, 365],
[2087, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30, 365],
[2088, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31, 366],
[2089, 30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31, 365],
[2090, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30, 365],
[2091, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30, 365],
[2092, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31, 366],
[2093, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31, 365],
[2094, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30, 365],
[2095, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30, 365],
[2096, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31, 366],
[2097, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30, 365],
[2098, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30, 365],
[2099, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30, 365],
[2100, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31, 366],
];

// Include the progressive sum at the end of the array
exports.NEPALI_DATE_MAP.forEach((l, idx, arr) => {
l.push(l[13] + (idx === 0 ? 0 : arr[idx - 1][14]));
});
});
2 changes: 1 addition & 1 deletion src/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,4 +201,4 @@ function tokenize(formatStr) {
// dddd week day nepali full form
export default function format(nepaliDate, formatStr) {
return tokenize(formatStr).map(f => f(nepaliDate)).join('');
}
}
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import NepaliDate from './NepaliDate';

export default NepaliDate;
module.exports = NepaliDate;
module.exports = NepaliDate;
2 changes: 1 addition & 1 deletion src/scripts/ad2bs.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ if (ad < NepaliDate.minimum() || ad > NepaliDate.maximum()) {
}

const n = new NepaliDate(ad);
console.log(n.toString());
console.log(n.toString());
2 changes: 1 addition & 1 deletion src/scripts/bs2ad.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ try {
} catch (err) {
console.log(err.message);
process.exit(1);
}
}