@bbn/bbn 2.0.156 → 2.0.161

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.
@@ -134,9 +134,18 @@ class bbnDtDuration {
134
134
  * Add any unit (or instance default).
135
135
  */
136
136
  add(value, unit) {
137
- const targetUnit = unit
138
- ? (unitsCorrespondence[unit] || unit)
139
- : __classPrivateFieldGet(this, _bbnDtDuration_unit, "f");
137
+ let targetUnit = __classPrivateFieldGet(this, _bbnDtDuration_unit, "f");
138
+ if (unit) {
139
+ if (unitsCorrespondence[unit]) {
140
+ const realUnit = getRow(units, (a) => a[0] === unitsCorrespondence[unit]);
141
+ if (realUnit) {
142
+ targetUnit = realUnit[1];
143
+ }
144
+ }
145
+ else {
146
+ targetUnit = unit;
147
+ }
148
+ }
140
149
  // Map to Temporal.DurationLike field name, e.g. 'year' → 'years'
141
150
  const field = (targetUnit + 's');
142
151
  if (!['years', 'months', 'weeks', 'days', 'hours', 'minutes', 'seconds', 'milliseconds'].includes(field)) {
@@ -257,6 +257,7 @@ const buildLocaleFromIntl = () => {
257
257
  weekdaysShort.push(fmtWeekShort.format(d));
258
258
  }
259
259
  const { date, time, datetime } = getCommonFormatsForLocale(langs);
260
+ const weekInfo = locale.getWeekInfo();
260
261
  extend(bbn.dt.locales, {
261
262
  formatters: {
262
263
  short: fmtShort,
@@ -264,7 +265,7 @@ const buildLocaleFromIntl = () => {
264
265
  numeric: fmtNum,
265
266
  relative: rtf
266
267
  },
267
- firstDayOfWeek: locale.weekInfo.firstDay,
268
+ firstDayOfWeek: weekInfo.firstDay,
268
269
  monthsLong,
269
270
  monthsShort,
270
271
  weekdaysLong,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbn/bbn",
3
- "version": "2.0.156",
3
+ "version": "2.0.161",
4
4
  "description": "Javascript toolkit",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",