@bbn/bbn 2.0.12 → 2.0.14

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.d.ts CHANGED
@@ -57,6 +57,7 @@ declare class bbnDateTool {
57
57
  get HH(): string;
58
58
  get H(): string;
59
59
  get II(): string;
60
+ get mm(): string;
60
61
  get I(): string;
61
62
  get SS(): string;
62
63
  get S(): string;
package/dist/date.js CHANGED
@@ -450,6 +450,17 @@ class bbnDateTool {
450
450
  ctx.month = n;
451
451
  }
452
452
  },
453
+ {
454
+ token: 'mm',
455
+ regex: '\\d{2}',
456
+ apply: v => {
457
+ const n = parseInt(v, 10);
458
+ if (n < 0 || n > 59) {
459
+ throw new Error('Invalid minute: ' + n);
460
+ }
461
+ ctx.month = n;
462
+ }
463
+ },
453
464
  {
454
465
  token: 'M',
455
466
  regex: '\\d{1,2}',
@@ -776,12 +787,7 @@ class bbnDateTool {
776
787
  __classPrivateFieldSet(this, _bbnDateTool_value, new Date(), "f");
777
788
  }
778
789
  else if (inputFormat) {
779
- try {
780
- __classPrivateFieldSet(this, _bbnDateTool_value, bbnDateTool.parse(value, inputFormat), "f");
781
- }
782
- catch (e) {
783
- throw new Error('Error parsing date with format "' + inputFormat + '": ' + e.message);
784
- }
790
+ __classPrivateFieldSet(this, _bbnDateTool_value, bbnDateTool.parse(value, inputFormat), "f");
785
791
  }
786
792
  else {
787
793
  if (t === 'number' || (isNumber(value) && value !== '')) {
@@ -984,6 +990,10 @@ class bbnDateTool {
984
990
  const i = parseInt(this.minute().toString());
985
991
  return i < 10 ? '0' + i.toString() : i.toString();
986
992
  }
993
+ get mm() {
994
+ const i = parseInt(this.minute().toString());
995
+ return i < 10 ? '0' + i.toString() : i.toString();
996
+ }
987
997
  get I() {
988
998
  return this.minute().toString();
989
999
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbn/bbn",
3
- "version": "2.0.12",
3
+ "version": "2.0.14",
4
4
  "description": "Javascript toolkit",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",