@bbn/bbn 1.0.441 → 1.0.443

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/date.js CHANGED
@@ -95,7 +95,7 @@ const patterns = [
95
95
  },
96
96
  ];
97
97
  const unitsMap = {
98
- 'y': 'FullYear',
98
+ 'y': 'Year',
99
99
  'm': 'Month',
100
100
  'd': 'Date',
101
101
  'h': 'Hours',
@@ -241,7 +241,7 @@ class bbnDateTool {
241
241
  const date = __classPrivateFieldGet(this, _bbnDateTool_value, "f") ? new Date(__classPrivateFieldGet(this, _bbnDateTool_value, "f").getTime()) : new Date();
242
242
  if (unitsCorrespondence[unit]) {
243
243
  const realUnit = unitsCorrespondence[unit];
244
- const suffix = unitsMap[realUnit];
244
+ const suffix = unitsMap[realUnit === 'year' ? 'FullYear' : realUnit];
245
245
  const getter = 'get' + suffix;
246
246
  const setter = 'set' + suffix;
247
247
  date[setter](date[getter]() + value);
@@ -257,14 +257,13 @@ class bbnDateTool {
257
257
  return d;
258
258
  }
259
259
  format(format = '') {
260
- const date = __classPrivateFieldGet(this, _bbnDateTool_value, "f") ? new Date(__classPrivateFieldGet(this, _bbnDateTool_value, "f").getTime()) : new Date();
261
260
  let str = '';
262
261
  if (format) {
263
262
  const parts = format.split('/(' + Object.keys(unitsCorrespondence).join('|') + ')/');
264
263
  each(parts, (part) => {
265
264
  if (part in unitsCorrespondence) {
266
- const suffix = unitsMap[unitsCorrespondence[part]];
267
- str += date[suffix];
265
+ const suffix = unitsMap[unitsCorrespondence[part]].toLowerCase();
266
+ str += this[suffix];
268
267
  }
269
268
  else {
270
269
  str += part;
@@ -304,7 +303,7 @@ class bbnDateTool {
304
303
  const order = ['y', 'm', 'd', 'h', 'n', 's'];
305
304
  // Compare step by step until the requested precision
306
305
  for (const u of order) {
307
- const key = unitsMap[u];
306
+ const key = unitsMap[u].toLowerCase();
308
307
  const a = this[key];
309
308
  const b = d[key];
310
309
  if (a < b) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbn/bbn",
3
- "version": "1.0.441",
3
+ "version": "1.0.443",
4
4
  "description": "Javascript toolkit",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",