@sbspk/bs 6.0.0 → 7.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/dist/calendar.js CHANGED
@@ -1,6 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = [
1
+ export default [
4
2
  [1970, [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30]],
5
3
  [1971, [31, 31, 32, 31, 32, 30, 30, 29, 30, 29, 30, 30]],
6
4
  [1972, [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31]],
package/dist/index.js CHANGED
@@ -1,14 +1,8 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.toCommonEra = exports.toBikramSambat = void 0;
7
- const calendar_1 = __importDefault(require("./calendar"));
8
- const CALENDAR_MONTHS = calendar_1.default.flatMap((yearRow) => yearRow[1]);
1
+ import CALENDAR from './calendar';
2
+ const CALENDAR_MONTHS = CALENDAR.flatMap((yearRow) => yearRow[1]);
9
3
  const START_DATE_CE = Date.UTC(1913, 4 - 1, 13); // 1913-04-13 js months are 0 indexed
10
- const START_YEAR_BS = calendar_1.default[0][0];
11
- function toBikramSambat({ day, month, year }) {
4
+ const START_YEAR_BS = CALENDAR[0][0];
5
+ export function toBikramSambat({ day, month, year }) {
12
6
  const date = Date.UTC(year, month - 1, day);
13
7
  if (date < START_DATE_CE) {
14
8
  throw new Error(`The date ${year}/${month}/${day} is not supported.`);
@@ -28,8 +22,7 @@ function toBikramSambat({ day, month, year }) {
28
22
  }
29
23
  throw new Error(`The date ${year}/${month}/${day} is not supported.`);
30
24
  }
31
- exports.toBikramSambat = toBikramSambat;
32
- function toCommonEra({ year, month, day }) {
25
+ export function toCommonEra({ year, month, day }) {
33
26
  const monthIndex = month - 1;
34
27
  const yearIndex = year - START_YEAR_BS;
35
28
  const previousMonthsRange = yearIndex * 12 + monthIndex;
@@ -49,4 +42,3 @@ function toCommonEra({ year, month, day }) {
49
42
  day: date.getUTCDate()
50
43
  };
51
44
  }
52
- exports.toCommonEra = toCommonEra;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sbspk/bs",
3
- "version": "6.0.0",
3
+ "version": "7.0.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "description": "Convert Bikram Sambat to Common Era and vice versa.",