@bchr/bchr-front-lib 0.3.101 → 0.3.105

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.
@@ -1,26 +1,48 @@
1
1
  "use strict";
2
2
 
3
- window.AppFormulaFunctions = {};
4
-
5
- window.AppFormulaFunctions.currentMonthStartDay = function (date) {
6
- var currentDate = new Date(date),
7
- currentYear = currentDate.getFullYear(),
8
- currentMouth = currentDate.getMonth() + 1;
9
- return currentYear + "-" + currentMouth + "-1";
10
- };
11
-
12
- window.AppFormulaFunctions.nextMonthStartDay = function (date) {
13
- var currentDate = new Date(date),
14
- currentYear = currentDate.getFullYear(),
15
- currentMouth = currentDate.getMonth() + 1;
16
- return new Date(currentYear, currentMouth, 1);
17
- };
18
-
19
- window.AppFormulaFunctions.currentDateToDeadline = function (date, during) {
20
- debugger;
21
- var changeDate = new Date(new Date(date).getTime() + during * 24 * 60 * 60 * 1000);
22
- var changeYear = changeDate.getFullYear(),
23
- changeMouth = changeDate.getMonth() + 1,
24
- changeDay = changeDate.getDay();
25
- return changeYear + '-' + changeMouth + '-' + changeDay;
3
+ var _moment = _interopRequireDefault(require("moment"));
4
+
5
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
6
+
7
+ window.AppFormulaFunctions = {
8
+ currentMonthStartDay: function currentMonthStartDay(dateStr) {
9
+ if (dateStr) {
10
+ var baseDate = (0, _moment["default"])(dateStr, "YYYY-MM-DD");
11
+ return baseDate.date(1).format("YYYY-MM-DD");
12
+ }
13
+
14
+ return null;
15
+ },
16
+ nextMonthStartDay: function nextMonthStartDay(dateStr) {
17
+ if (dateStr) {
18
+ var baseDate = (0, _moment["default"])(dateStr, "YYYY-MM-DD");
19
+ return baseDate.add(1, 'months').date(1).format("YYYY-MM-DD");
20
+ }
21
+
22
+ return null;
23
+ },
24
+ datePlusDays: function datePlusDays(dateStr, during_days) {
25
+ if (dateStr && during_days) {
26
+ var baseDate = (0, _moment["default"])(dateStr, "YYYY-MM-DD");
27
+ return baseDate.add(during_days, 'days').format("YYYY-MM-DD");
28
+ }
29
+
30
+ return null;
31
+ },
32
+ datePlusMonths: function datePlusMonths(dateStr, during_months) {
33
+ if (dateStr && during_months) {
34
+ var baseDate = (0, _moment["default"])(dateStr, "YYYY-MM-DD");
35
+ return baseDate.add(during_months, 'months').format("YYYY-MM-DD");
36
+ }
37
+
38
+ return null;
39
+ },
40
+ datePlusYears: function datePlusYears(dateStr, during_years) {
41
+ if (dateStr && during_years) {
42
+ var baseDate = (0, _moment["default"])(dateStr, "YYYY-MM-DD");
43
+ return baseDate.add(during_years, 'years').format("YYYY-MM-DD");
44
+ }
45
+
46
+ return null;
47
+ }
26
48
  };
@@ -372,7 +372,7 @@ var FormForBrowse = /*#__PURE__*/function (_React$Component) {
372
372
  if (typeof initialValue === 'boolean') {
373
373
  value = initialValues[display_code] ? "是" : "否";
374
374
  } else {
375
- value = (initialValue || '').toLowerCase() === 'true' ? "是" : "否";
375
+ value = (initialValue + '' || '').toLowerCase() === 'true' || (initialValue + '' || '').toLowerCase() === '1' ? "是" : "否";
376
376
  }
377
377
 
378
378
  break;