@bbn/bbn 2.0.62 → 2.0.64

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.
@@ -0,0 +1,185 @@
1
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
+ if (kind === "m") throw new TypeError("Private method is not writable");
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
+ };
7
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
+ };
12
+ var _bbnDtDuration_instances, _bbnDtDuration_value, _bbnDtDuration_unit, _bbnDtDuration_getUnitValue;
13
+ import { Temporal } from 'temporal-polyfill';
14
+ import { units, unitsCorrespondence } from '../vars/units.js';
15
+ import getRow from '../../fn/object/getRow.js';
16
+ const DURATION_RELATIVE_TO = Temporal.ZonedDateTime.from('1970-01-01T00:00Z[UTC]');
17
+ class bbnDtDuration {
18
+ static fromUnit(value, unit) {
19
+ const realUnit = unitsCorrespondence[unit] || 'ms';
20
+ if (!realUnit) {
21
+ throw new Error('Invalid unit for duration: ' + unit);
22
+ }
23
+ const ctx = [
24
+ realUnit === 'y' ? value : 0,
25
+ realUnit === 'm' ? value : 0,
26
+ realUnit === 'd' ? value : 0,
27
+ realUnit === 'h' ? value : 0,
28
+ realUnit === 'i' ? value : 0,
29
+ realUnit === 's' ? value : 0,
30
+ ['y', 'm', 'd', 'h', 'i', 's'].includes(realUnit) ? 0 : value
31
+ ];
32
+ const dur = new Temporal.Duration(...ctx);
33
+ return new bbnDtDuration(dur, 0, 0, 0, 0, 0, 0, realUnit);
34
+ }
35
+ constructor(y, m, d, h, i, s, ms, unit) {
36
+ _bbnDtDuration_instances.add(this);
37
+ _bbnDtDuration_value.set(this, void 0);
38
+ _bbnDtDuration_unit.set(this, void 0);
39
+ if (y instanceof Temporal.Duration) {
40
+ __classPrivateFieldSet(this, _bbnDtDuration_value, y, "f");
41
+ }
42
+ else if (typeof y === 'object') {
43
+ __classPrivateFieldSet(this, _bbnDtDuration_value, new Temporal.Duration(y.years || 0, y.months || 0, y.weeks || 0, y.days || 0, y.hours || 0, y.minutes || 0, y.seconds || 0, y.milliseconds || 0, 0, 0), "f");
44
+ }
45
+ else {
46
+ __classPrivateFieldSet(this, _bbnDtDuration_value, new Temporal.Duration(y || 0, m || 0, d || 0, h || 0, i || 0, s || 0, ms || 0, 0, 0), "f");
47
+ }
48
+ const realUnit = unitsCorrespondence[unit || ''] || unit;
49
+ __classPrivateFieldSet(this, _bbnDtDuration_unit, realUnit || 'ms', "f");
50
+ const row = getRow(units, (a) => a[0] === realUnit);
51
+ if (!row) {
52
+ throw new Error('Invalid unit for duration: ' + realUnit);
53
+ }
54
+ }
55
+ get value() {
56
+ return __classPrivateFieldGet(this, _bbnDtDuration_value, "f");
57
+ }
58
+ // -----------------------
59
+ // Public getters
60
+ // -----------------------
61
+ years(remaining = false) { return __classPrivateFieldGet(this, _bbnDtDuration_instances, "m", _bbnDtDuration_getUnitValue).call(this, 'year', remaining); }
62
+ months(remaining = false) { return __classPrivateFieldGet(this, _bbnDtDuration_instances, "m", _bbnDtDuration_getUnitValue).call(this, 'month', remaining); }
63
+ weeks(remaining = false) { return __classPrivateFieldGet(this, _bbnDtDuration_instances, "m", _bbnDtDuration_getUnitValue).call(this, 'week', remaining); }
64
+ days(remaining = false) { return __classPrivateFieldGet(this, _bbnDtDuration_instances, "m", _bbnDtDuration_getUnitValue).call(this, 'day', remaining); }
65
+ hours(remaining = false) { return __classPrivateFieldGet(this, _bbnDtDuration_instances, "m", _bbnDtDuration_getUnitValue).call(this, 'hour', remaining); }
66
+ minutes(remaining = false) { return __classPrivateFieldGet(this, _bbnDtDuration_instances, "m", _bbnDtDuration_getUnitValue).call(this, 'minute', remaining); }
67
+ seconds(remaining = false) { return __classPrivateFieldGet(this, _bbnDtDuration_instances, "m", _bbnDtDuration_getUnitValue).call(this, 'second', remaining); }
68
+ // -----------------------
69
+ // Day.js style
70
+ // "asX" conversions
71
+ // -----------------------
72
+ toJSON() {
73
+ return {
74
+ years: this.years(true),
75
+ months: this.months(true),
76
+ days: this.days(true),
77
+ hours: this.hours(true),
78
+ minutes: this.minutes(true),
79
+ seconds: this.seconds(true),
80
+ milliseconds: this.toMilliseconds()
81
+ };
82
+ }
83
+ /**
84
+ * Returns the full duration expressed as X (float), like Day.js.
85
+ */
86
+ asYears() {
87
+ return __classPrivateFieldGet(this, _bbnDtDuration_value, "f").total({
88
+ unit: 'year',
89
+ relativeTo: DURATION_RELATIVE_TO
90
+ });
91
+ }
92
+ asMonths() {
93
+ return __classPrivateFieldGet(this, _bbnDtDuration_value, "f").total({
94
+ unit: 'month',
95
+ relativeTo: DURATION_RELATIVE_TO
96
+ });
97
+ }
98
+ asWeeks() {
99
+ return __classPrivateFieldGet(this, _bbnDtDuration_value, "f").total({
100
+ unit: 'week',
101
+ relativeTo: DURATION_RELATIVE_TO
102
+ });
103
+ }
104
+ asDays() {
105
+ return __classPrivateFieldGet(this, _bbnDtDuration_value, "f").total({
106
+ unit: 'day',
107
+ relativeTo: DURATION_RELATIVE_TO
108
+ });
109
+ }
110
+ asHours() {
111
+ return __classPrivateFieldGet(this, _bbnDtDuration_value, "f").total({
112
+ unit: 'hour',
113
+ relativeTo: DURATION_RELATIVE_TO
114
+ });
115
+ }
116
+ asMinutes() {
117
+ return __classPrivateFieldGet(this, _bbnDtDuration_value, "f").total({
118
+ unit: 'minute',
119
+ relativeTo: DURATION_RELATIVE_TO
120
+ });
121
+ }
122
+ asSeconds() {
123
+ return __classPrivateFieldGet(this, _bbnDtDuration_value, "f").total({
124
+ unit: 'second',
125
+ relativeTo: DURATION_RELATIVE_TO
126
+ });
127
+ }
128
+ /**
129
+ * Add any unit (or instance default).
130
+ */
131
+ add(value, unit) {
132
+ const targetUnit = unit
133
+ ? (unitsCorrespondence[unit] || unit)
134
+ : __classPrivateFieldGet(this, _bbnDtDuration_unit, "f");
135
+ // Map to Temporal.DurationLike field name, e.g. 'year' → 'years'
136
+ const field = (targetUnit + 's');
137
+ if (!['years', 'months', 'weeks', 'days', 'hours', 'minutes', 'seconds', 'milliseconds'].includes(field)) {
138
+ throw new Error('Invalid unit for duration: ' + (unit !== null && unit !== void 0 ? unit : targetUnit));
139
+ }
140
+ const delta = { [field]: value };
141
+ const newDuration = __classPrivateFieldGet(this, _bbnDtDuration_value, "f").add(delta);
142
+ // Adapt this constructor call to however you now construct your duration:
143
+ return new bbnDtDuration(newDuration, undefined, undefined, undefined, undefined, undefined, undefined, __classPrivateFieldGet(this, _bbnDtDuration_unit, "f"));
144
+ }
145
+ subtract(value, unit) {
146
+ return this.add(-value, unit);
147
+ }
148
+ toMilliseconds() {
149
+ const d = __classPrivateFieldGet(this, _bbnDtDuration_value, "f");
150
+ // If there are no calendar units, we can let Temporal do it directly:
151
+ if (!d.years && !d.months && !d.weeks && !d.days) {
152
+ return d.total({ unit: 'millisecond' });
153
+ }
154
+ // Otherwise we must supply a relativeTo (same as in asX)
155
+ return d.total({
156
+ unit: 'millisecond',
157
+ relativeTo: DURATION_RELATIVE_TO
158
+ });
159
+ }
160
+ }
161
+ _bbnDtDuration_value = new WeakMap(), _bbnDtDuration_unit = new WeakMap(), _bbnDtDuration_instances = new WeakSet(), _bbnDtDuration_getUnitValue = function _bbnDtDuration_getUnitValue(name, remaining) {
162
+ const d = __classPrivateFieldGet(this, _bbnDtDuration_value, "f"); // Temporal.Duration
163
+ if (remaining) {
164
+ switch (name) {
165
+ case 'year': return d.years;
166
+ case 'month': return d.months;
167
+ case 'week': return d.weeks;
168
+ case 'day': return d.days;
169
+ case 'hour': return d.hours;
170
+ case 'minute': return d.minutes;
171
+ case 'second':
172
+ // seconds component only; sub-second parts go to milliseconds in toJSON()
173
+ return d.seconds;
174
+ }
175
+ }
176
+ // Total units: use Duration.total()
177
+ const total = d.total({
178
+ unit: name,
179
+ relativeTo: DURATION_RELATIVE_TO
180
+ });
181
+ // Keep same semantics as old code (Math.floor on totals)
182
+ return Math.floor(total);
183
+ };
184
+ export default bbnDtDuration;
185
+ ;
@@ -1,6 +1,10 @@
1
1
  import { Temporal } from 'temporal-polyfill';
2
- export default class bbnDtMonthDay {
2
+ import { BbnDtKind } from '../vars/types.js';
3
+ import bbnDt from './dt.js';
4
+ export default class bbnDtMonthDay extends bbnDt<Temporal.PlainMonthDay> {
3
5
  #private;
6
+ readonly kind: BbnDtKind;
4
7
  constructor(m?: any, d?: number);
5
8
  get value(): Temporal.PlainMonthDay;
9
+ fdate(long?: boolean, withTime?: boolean, weekday?: boolean): string;
6
10
  }
@@ -11,9 +11,12 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
11
11
  };
12
12
  var _bbnDtMonthDay_value;
13
13
  import { Temporal } from 'temporal-polyfill';
14
- class bbnDtMonthDay {
14
+ import bbnDt from './dt.js';
15
+ class bbnDtMonthDay extends bbnDt {
15
16
  constructor(m, d) {
17
+ super();
16
18
  _bbnDtMonthDay_value.set(this, void 0);
19
+ this.kind = 'month-day';
17
20
  if (!m) {
18
21
  const d = new Date();
19
22
  __classPrivateFieldSet(this, _bbnDtMonthDay_value, new Temporal.PlainMonthDay(d.getMonth() + 1, d.getDate()), "f");
@@ -40,6 +43,18 @@ class bbnDtMonthDay {
40
43
  get value() {
41
44
  return __classPrivateFieldGet(this, _bbnDtMonthDay_value, "f");
42
45
  }
46
+ fdate(long = false, withTime = false, weekday = false) {
47
+ if (!this.value) {
48
+ return '';
49
+ }
50
+ const date = new Date(2000, this.month() - 1, this.day());
51
+ const opt = {
52
+ month: long ? 'long' : 'numeric',
53
+ day: 'numeric'
54
+ };
55
+ const d = new Intl.DateTimeFormat([bbn.env.lang, ...navigator.languages], opt);
56
+ return d.format(date);
57
+ }
43
58
  }
44
59
  _bbnDtMonthDay_value = new WeakMap();
45
60
  export default bbnDtMonthDay;
@@ -1,6 +1,9 @@
1
1
  import { Temporal } from 'temporal-polyfill';
2
- export default class bbnDtTime {
2
+ import bbnDt from './dt.js';
3
+ export default class bbnDtTime extends bbnDt<Temporal.PlainTime> {
3
4
  #private;
5
+ readonly kind: 'time';
4
6
  constructor(h?: any, i?: number, s?: number, ms?: number);
5
7
  get value(): Temporal.PlainTime;
8
+ ftime(withSeconds?: boolean): string;
6
9
  }
@@ -11,9 +11,12 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
11
11
  };
12
12
  var _bbnDtTime_value;
13
13
  import { Temporal } from 'temporal-polyfill';
14
- class bbnDtTime {
14
+ import bbnDt from './dt.js';
15
+ class bbnDtTime extends bbnDt {
15
16
  constructor(h, i, s, ms) {
17
+ super();
16
18
  _bbnDtTime_value.set(this, void 0);
19
+ this.kind = 'time';
17
20
  if (!h) {
18
21
  const d = new Date();
19
22
  __classPrivateFieldSet(this, _bbnDtTime_value, new Temporal.PlainTime(d.getHours(), d.getMinutes(), d.getSeconds(), d.getMilliseconds() * 1000000), "f");
@@ -42,6 +45,21 @@ class bbnDtTime {
42
45
  get value() {
43
46
  return __classPrivateFieldGet(this, _bbnDtTime_value, "f");
44
47
  }
48
+ ftime(withSeconds = false) {
49
+ if (!this.value) {
50
+ return '';
51
+ }
52
+ const date = new Date(2000, 1, 1, this.hour(), this.minute(), this.second());
53
+ const opt = {
54
+ hour: '2-digit',
55
+ minute: '2-digit',
56
+ };
57
+ if (withSeconds) {
58
+ opt.second = '2-digit';
59
+ }
60
+ const t = new Intl.DateTimeFormat([bbn.env.lang, ...navigator.languages], opt);
61
+ return t.format(date);
62
+ }
45
63
  }
46
64
  _bbnDtTime_value = new WeakMap();
47
65
  export default bbnDtTime;
@@ -1,6 +1,10 @@
1
1
  import { Temporal } from 'temporal-polyfill';
2
- export default class bbnDtYearMonth {
2
+ import { BbnDtKind } from '../vars/types.js';
3
+ import { bbnDt } from './dt.js';
4
+ export default class bbnDtYearMonth extends bbnDt<Temporal.PlainYearMonth> {
3
5
  #private;
6
+ readonly kind: BbnDtKind;
4
7
  constructor(y?: any, m?: number);
5
8
  get value(): Temporal.PlainYearMonth;
9
+ fdate(long?: boolean, withTime?: boolean, weekday?: boolean): string;
6
10
  }
@@ -11,9 +11,12 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
11
11
  };
12
12
  var _bbnDtYearMonth_value;
13
13
  import { Temporal } from 'temporal-polyfill';
14
- class bbnDtYearMonth {
14
+ import { bbnDt } from './dt.js';
15
+ class bbnDtYearMonth extends bbnDt {
15
16
  constructor(y, m) {
17
+ super();
16
18
  _bbnDtYearMonth_value.set(this, void 0);
19
+ this.kind = 'year-month';
17
20
  if (!y) {
18
21
  const d = new Date();
19
22
  __classPrivateFieldSet(this, _bbnDtYearMonth_value, new Temporal.PlainYearMonth(d.getFullYear(), d.getMonth() + 1), "f");
@@ -37,6 +40,18 @@ class bbnDtYearMonth {
37
40
  get value() {
38
41
  return __classPrivateFieldGet(this, _bbnDtYearMonth_value, "f");
39
42
  }
43
+ fdate(long = false, withTime = false, weekday = false) {
44
+ if (!this.value) {
45
+ return '';
46
+ }
47
+ const date = new Date(this.year(), this.month() - 1);
48
+ const opt = {
49
+ year: 'numeric',
50
+ month: long ? 'long' : 'numeric',
51
+ };
52
+ const d = new Intl.DateTimeFormat([bbn.env.lang, ...navigator.languages], opt);
53
+ return d.format(date);
54
+ }
40
55
  }
41
56
  _bbnDtYearMonth_value = new WeakMap();
42
57
  export default bbnDtYearMonth;
@@ -1,6 +1,11 @@
1
1
  import { Temporal } from 'temporal-polyfill';
2
- export default class bbnDtZoned {
2
+ import { BbnDtKind } from '../vars/types.js';
3
+ import bbnDt from './dt.js';
4
+ export default class bbnDtZoned extends bbnDt<Temporal.ZonedDateTime> {
3
5
  #private;
6
+ readonly kind: BbnDtKind;
4
7
  constructor(z?: any, y?: any, m?: number, d?: number, h?: number, i?: number, s?: number, ms?: number);
5
8
  get value(): Temporal.ZonedDateTime;
9
+ fdate(long?: boolean, withTime?: boolean, weekday?: boolean): string;
10
+ ftime(withSeconds?: boolean): string;
6
11
  }
@@ -12,9 +12,12 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
12
12
  var _bbnDtZoned_value;
13
13
  import { Temporal } from 'temporal-polyfill';
14
14
  import fromJsDate from '../functions/fromJsDate.js';
15
- class bbnDtZoned {
15
+ import bbnDt from './dt.js';
16
+ class bbnDtZoned extends bbnDt {
16
17
  constructor(z, y, m, d, h, i, s, ms) {
18
+ super();
17
19
  _bbnDtZoned_value.set(this, void 0);
20
+ this.kind = 'zoned';
18
21
  if (!z) {
19
22
  const date = new Date();
20
23
  __classPrivateFieldSet(this, _bbnDtZoned_value, new Temporal.ZonedDateTime(BigInt(date.getTime() * 1000000), Intl.DateTimeFormat().resolvedOptions().timeZone), "f");
@@ -42,6 +45,30 @@ class bbnDtZoned {
42
45
  get value() {
43
46
  return __classPrivateFieldGet(this, _bbnDtZoned_value, "f");
44
47
  }
48
+ fdate(long = false, withTime = false, weekday = false) {
49
+ if (!this.value) {
50
+ return '';
51
+ }
52
+ const date = new Date(this.year(), this.month() - 1, this.day(), this.hour(), this.minute(), this.second());
53
+ const opt = Object.assign(Object.assign({ year: 'numeric', month: long ? 'long' : 'numeric', day: 'numeric' }, (weekday ? { weekday: (long ? 'long' : 'short') } : {})), (withTime ? { hour: (long ? '2-digit' : 'numeric'), minute: '2-digit' } : {}));
54
+ const d = new Intl.DateTimeFormat([bbn.env.lang, ...navigator.languages], opt);
55
+ return d.format(date);
56
+ }
57
+ ftime(withSeconds = false) {
58
+ if (!this.value) {
59
+ return '';
60
+ }
61
+ const date = new Date(2000, 1, 1, this.hour(), this.minute(), this.second());
62
+ const opt = {
63
+ hour: '2-digit',
64
+ minute: '2-digit',
65
+ };
66
+ if (withSeconds) {
67
+ opt.second = '2-digit';
68
+ }
69
+ const t = new Intl.DateTimeFormat([bbn.env.lang, ...navigator.languages], opt);
70
+ return t.format(date);
71
+ }
45
72
  }
46
73
  _bbnDtZoned_value = new WeakMap();
47
74
  export default bbnDtZoned;
@@ -0,0 +1,3 @@
1
+ declare const getWeekday: (n: 0 | 1 | 2 | 3 | 4 | 5 | 6, mode?: string, locale?: string) => any;
2
+ declare const getWeekdayIndex: (name: string, locale?: string) => number;
3
+ export { getWeekday, getWeekdayIndex };
@@ -0,0 +1,58 @@
1
+ const getWeekday = (n, mode = 'long', locale) => {
2
+ if (!mode) {
3
+ const letter = getWeekday(n, 'narrow', locale);
4
+ const abbr = getWeekday(n, 'short', locale);
5
+ const full = getWeekday(n, 'long', locale);
6
+ return {
7
+ letter,
8
+ abbr,
9
+ full,
10
+ long: full,
11
+ short: abbr,
12
+ narrow: letter
13
+ };
14
+ }
15
+ let m;
16
+ if (mode === 'letter') {
17
+ m = 'narrow';
18
+ }
19
+ else if (mode === 'abbr') {
20
+ m = 'short';
21
+ }
22
+ else if (mode === 'full') {
23
+ m = 'long';
24
+ }
25
+ else if (!['long', 'short', 'narrow'].includes(mode)) {
26
+ throw new Error('Invalid mode for getWeekDay: ' + mode + '. Allowed values are "long", "short", "narrow", "letter", "abbr", "full".');
27
+ }
28
+ else {
29
+ m = mode;
30
+ }
31
+ // Create a date with the right weekday
32
+ // 2023-01-01 was a Sunday → base for offset
33
+ const base = new Date(2023, 0, 1 + n);
34
+ return base.toLocaleDateString([locale || bbn.env.lang, ...navigator.languages], { weekday: m });
35
+ };
36
+ const getWeekdayIndex = (name, locale) => {
37
+ const loc = locale || bbn.env.lang;
38
+ const input = name.trim().toLowerCase();
39
+ // Build a localized map only once per locale (optional optimization)
40
+ const langs = [loc, ...navigator.languages];
41
+ for (let i = 0; i < langs.length; i++) {
42
+ if (!langs[i]) {
43
+ continue;
44
+ }
45
+ const formatter = new Intl.DateTimeFormat(langs[i], { weekday: "long" });
46
+ // Generate localized weekday names for Sun → Sat
47
+ for (let i = 0; i < 7; i++) {
48
+ // 2023-01-01 was Sunday
49
+ const date = new Date(2023, 0, 1 + i);
50
+ const localized = formatter.format(date).toLowerCase();
51
+ if (localized === input) {
52
+ return i; // JS weekday number
53
+ }
54
+ }
55
+ }
56
+ throw new Error(`Unknown weekday name '${name}' for locale '${loc}'`);
57
+ };
58
+ export { getWeekday, getWeekdayIndex };
@@ -0,0 +1,3 @@
1
+ import { Temporal } from 'temporal-polyfill';
2
+ export type BbnDtKind = 'datetime' | 'date' | 'time' | 'year-month' | 'month-day' | 'zoned';
3
+ export type BbnDtTemporal = Temporal.PlainDateTime | Temporal.PlainDate | Temporal.PlainTime | Temporal.PlainYearMonth | Temporal.PlainMonthDay | Temporal.ZonedDateTime;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ declare const units: [string, Intl.RelativeTimeFormatUnit, number][];
2
+ declare const unitsCorrespondence: {
3
+ [key: string]: string;
4
+ };
5
+ declare const unitsMap: {
6
+ [key: string]: string;
7
+ };
8
+ declare const formatsMap: {
9
+ [key: string]: string;
10
+ };
11
+ export { units, unitsCorrespondence, unitsMap, formatsMap };
@@ -0,0 +1,109 @@
1
+ const units = [
2
+ ['y', "year", 365 * 24 * 60 * 60 * 1000],
3
+ ['m', "month", 30 * 24 * 60 * 60 * 1000],
4
+ ['w', "week", 7 * 24 * 60 * 60 * 1000],
5
+ ['d', "day", 24 * 60 * 60 * 1000],
6
+ ['h', "hour", 60 * 60 * 1000],
7
+ ['i', "minute", 60 * 1000],
8
+ ['s', "second", 1000]
9
+ ];
10
+ const unitsCorrespondence = {
11
+ 'years': 'y',
12
+ 'year': 'y',
13
+ 'YEARS': 'y',
14
+ 'YEAR': 'y',
15
+ 'Years': 'y',
16
+ 'Year': 'y',
17
+ 'YYYY': 'y',
18
+ 'YY': 'y',
19
+ 'yyyy': 'y',
20
+ 'yy': 'y',
21
+ 'months': 'm',
22
+ 'month': 'm',
23
+ 'Months': 'm',
24
+ 'Month': 'm',
25
+ 'MONTHS': 'm',
26
+ 'MONTH': 'm',
27
+ 'MMMM': 'm',
28
+ 'MMM': 'm',
29
+ 'MM': 'm',
30
+ 'weekday': 'e',
31
+ 'WEEKDAY': 'e',
32
+ 'ee': 'e',
33
+ 'EE': 'e',
34
+ 'ddd': 'e',
35
+ 'days': 'd',
36
+ 'day': 'd',
37
+ 'Days': 'd',
38
+ 'Day': 'd',
39
+ 'DAYS': 'd',
40
+ 'DAY': 'd',
41
+ 'DD': 'd',
42
+ 'dd': 'd',
43
+ 'hours': 'h',
44
+ 'hour': 'h',
45
+ 'Hours': 'h',
46
+ 'Hour': 'h',
47
+ 'HOURS': 'h',
48
+ 'HOUR': 'h',
49
+ 'HH': 'h',
50
+ 'hr': 'h',
51
+ 'hh': 'h',
52
+ 'minutes': 'i',
53
+ 'minute': 'i',
54
+ 'Minutes': 'i',
55
+ 'Minute': 'i',
56
+ 'MINUTES': 'i',
57
+ 'MINUTE': 'i',
58
+ 'II': 'i',
59
+ 'ii': 'i',
60
+ 'mn': 'i',
61
+ 'mm': 'i',
62
+ 'min': 'i',
63
+ 'SS': 's',
64
+ 'ss': 's',
65
+ 'seconds': 's',
66
+ 'second': 's',
67
+ 'Seconds': 's',
68
+ 'Second': 's',
69
+ 'SECONDS': 's',
70
+ 'SECOND': 's',
71
+ 'sec': 's',
72
+ 'WW': 'w',
73
+ 'Y': 'y',
74
+ 'y': 'y',
75
+ 'M': 'm',
76
+ 'm': 'm',
77
+ 'e': 'e',
78
+ 'E': 'e',
79
+ 'D': 'd',
80
+ 'd': 'd',
81
+ 'H': 'h',
82
+ 'h': 'h',
83
+ 'n': 'i',
84
+ 'i': 'i',
85
+ 's': 's',
86
+ 'S': 's',
87
+ 'W': 'w',
88
+ 'w': 'w'
89
+ };
90
+ const unitsMap = {
91
+ 'y': 'Year',
92
+ 'm': 'Month',
93
+ 'd': 'Date',
94
+ 'w': 'Week',
95
+ 'h': 'Hours',
96
+ 'i': 'Minutes',
97
+ 's': 'Seconds'
98
+ };
99
+ const formatsMap = {
100
+ 'y': 'YYYY',
101
+ 'm': 'MM',
102
+ 'd': 'DD',
103
+ 'e': 'EE',
104
+ 'w': 'WW',
105
+ 'h': 'HH',
106
+ 'i': 'II',
107
+ 's': 'SS'
108
+ };
109
+ export { units, unitsCorrespondence, unitsMap, formatsMap };
package/dist/dt.d.ts CHANGED
@@ -2,7 +2,7 @@ import bbnDtDateTime from './dt/classes/dateTime.js';
2
2
  import parse from './dt/functions/parse.js';
3
3
  import guessFormat from './dt/functions/guessFormat.js';
4
4
  declare const dt: {
5
- (value: any, inputFormat?: null | String, cls?: "auto" | "zoned" | "dateTime" | "date" | "time" | "yearMonth" | "monthDay"): bbnDtDateTime | import("./dt/classes/zoned.js").default | import("./dt/classes/date.js").default | import("./dt/classes/time.js").default | import("./dt/classes/yearMonth.js").default | import("./dt/classes/monthDay.js").default;
5
+ (value: any, inputFormat?: null | String, cls?: "auto" | "zoned" | "dateTime" | "date" | "time" | "yearMonth" | "monthDay"): import("./dt/classes/zoned.js").default | import("./dt/classes/date.js").default | import("./dt/classes/time.js").default | import("./dt/classes/yearMonth.js").default | import("./dt/classes/monthDay.js").default | bbnDtDateTime;
6
6
  locales: any;
7
7
  parse: typeof parse;
8
8
  guessFormat: typeof guessFormat;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbn/bbn",
3
- "version": "2.0.62",
3
+ "version": "2.0.64",
4
4
  "description": "Javascript toolkit",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",