@bbn/bbn 2.0.160 → 2.0.163

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,7 +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
+ const weekInfo = locale.getWeekInfo ? locale.getWeekInfo() : { firstDayOfWeek: 1 };
261
261
  extend(bbn.dt.locales, {
262
262
  formatters: {
263
263
  short: fmtShort,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbn/bbn",
3
- "version": "2.0.160",
3
+ "version": "2.0.163",
4
4
  "description": "Javascript toolkit",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",