@webuildbots/webuildbots-sdk 9.2.5 → 9.3.1

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.
@@ -13,7 +13,8 @@ export declare enum BlockTypes {
13
13
  COMPLEX = "complex",
14
14
  SELECT = "select",
15
15
  FUNCTION = "function",
16
- DEV_SWITCH = "dev-switch"
16
+ DEV_SWITCH = "dev-switch",
17
+ VARIABLE = "variable"
17
18
  }
18
19
  export declare enum ChoiceTypes {
19
20
  QREPLY = "qreply",
@@ -19,6 +19,7 @@ var BlockTypes;
19
19
  BlockTypes["SELECT"] = "select";
20
20
  BlockTypes["FUNCTION"] = "function";
21
21
  BlockTypes["DEV_SWITCH"] = "dev-switch";
22
+ BlockTypes["VARIABLE"] = "variable";
22
23
  })(BlockTypes = exports.BlockTypes || (exports.BlockTypes = {}));
23
24
  var ChoiceTypes;
24
25
  (function (ChoiceTypes) {
@@ -117,7 +117,7 @@ export default interface Block {
117
117
  handlerName?: string;
118
118
  type?: string;
119
119
  logic?: {
120
- formId: string;
120
+ formId?: string;
121
121
  defaultMappingBlockId: string;
122
122
  expressions?: Array<{
123
123
  condition: any;
@@ -1,4 +1,3 @@
1
- import moment from 'moment';
2
1
  export declare class Utils {
3
- static parseDate: (formValue: string) => moment.Moment;
2
+ static parseDate: (formValue: string, languageCode: string) => string;
4
3
  }
package/lib/util/utils.js CHANGED
@@ -1,25 +1,14 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.Utils = void 0;
7
- var moment_1 = __importDefault(require("moment"));
8
- var dateFormats = [
9
- 'DD/MM/YYYY',
10
- 'DD-MM-YYYY',
11
- 'D-M-YYYY',
12
- 'D/M/YYYY',
13
- 'DD/MM/YY',
14
- 'DD-MM-YY',
15
- 'D-M-YY',
16
- 'D/M/YY'
17
- ];
4
+ var sugar_1 = require("sugar");
18
5
  var Utils = /** @class */ (function () {
19
6
  function Utils() {
20
7
  }
21
- Utils.parseDate = function (formValue) {
22
- return moment_1.default(formValue.trim(), dateFormats, true).startOf('day');
8
+ Utils.parseDate = function (formValue, languageCode) {
9
+ sugar_1.Date.setLocale('en-GB');
10
+ var date = new sugar_1.Date(sugar_1.Date.create(formValue, { locale: languageCode })).short('en-GB');
11
+ return date.raw;
23
12
  };
24
13
  return Utils;
25
14
  }());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webuildbots/webuildbots-sdk",
3
- "version": "9.2.5",
3
+ "version": "9.3.1",
4
4
  "description": "webuildbots sdk",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -60,6 +60,7 @@
60
60
  "jsonwebtoken": "^8.5.1",
61
61
  "md5": "^2.3.0",
62
62
  "moment": "^2.29.3",
63
+ "sugar": "^2.0.6",
63
64
  "wbb-logger": "^1.1.0"
64
65
  }
65
66
  }