@bbn/bbn 2.0.160 → 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)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbn/bbn",
3
- "version": "2.0.160",
3
+ "version": "2.0.161",
4
4
  "description": "Javascript toolkit",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",