envoc-form 3.3.0 → 3.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.
@@ -48,7 +48,7 @@ var DatePickerInput = /*#__PURE__*/function (_React$Component) {
48
48
  onChange(null);
49
49
  } else {
50
50
  // ensure ONLY the date is persisted - so UTC offset info / time is not persisted or sent
51
- onChange(e.toISOString().split('T')[0]);
51
+ onChange(convertToTimeZoneInsensitiveISOString(e).split('T')[0]);
52
52
  }
53
53
  });
54
54
 
@@ -92,4 +92,16 @@ var DatePickerInput = /*#__PURE__*/function (_React$Component) {
92
92
  return DatePickerInput;
93
93
  }(React.Component);
94
94
 
95
- export { DatePickerInput as default };
95
+ export { DatePickerInput as default };
96
+ export function convertToTimeZoneInsensitiveISOString(date) {
97
+ var year = new Intl.DateTimeFormat('en', {
98
+ year: 'numeric'
99
+ }).format(date);
100
+ var month = new Intl.DateTimeFormat('en', {
101
+ month: '2-digit'
102
+ }).format(date);
103
+ var day = new Intl.DateTimeFormat('en', {
104
+ day: '2-digit'
105
+ }).format(date);
106
+ return "".concat(year, "-").concat(month, "-").concat(day, "T00:00:00.000Z");
107
+ }
@@ -5,6 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
+ exports.convertToTimeZoneInsensitiveISOString = convertToTimeZoneInsensitiveISOString;
8
9
  exports["default"] = void 0;
9
10
 
10
11
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
@@ -68,7 +69,7 @@ var DatePickerInput = /*#__PURE__*/function (_React$Component) {
68
69
  onChange(null);
69
70
  } else {
70
71
  // ensure ONLY the date is persisted - so UTC offset info / time is not persisted or sent
71
- onChange(e.toISOString().split('T')[0]);
72
+ onChange(convertToTimeZoneInsensitiveISOString(e).split('T')[0]);
72
73
  }
73
74
  });
74
75
  return _this;
@@ -110,4 +111,17 @@ var DatePickerInput = /*#__PURE__*/function (_React$Component) {
110
111
  return DatePickerInput;
111
112
  }(_react["default"].Component);
112
113
 
113
- exports["default"] = DatePickerInput;
114
+ exports["default"] = DatePickerInput;
115
+
116
+ function convertToTimeZoneInsensitiveISOString(date) {
117
+ var year = new Intl.DateTimeFormat('en', {
118
+ year: 'numeric'
119
+ }).format(date);
120
+ var month = new Intl.DateTimeFormat('en', {
121
+ month: '2-digit'
122
+ }).format(date);
123
+ var day = new Intl.DateTimeFormat('en', {
124
+ day: '2-digit'
125
+ }).format(date);
126
+ return "".concat(year, "-").concat(month, "-").concat(day, "T00:00:00.000Z");
127
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "envoc-form",
3
- "version": "3.3.0",
3
+ "version": "3.3.1",
4
4
  "description": "Envoc form components",
5
5
  "keywords": [
6
6
  "react-component",
@@ -26,7 +26,7 @@
26
26
  "axios": "^0.21.1",
27
27
  "classnames": "^2.3.1",
28
28
  "date-fns": "^2.22.1",
29
- "envoc-request": "^3.3.0",
29
+ "envoc-request": "^3.3.1",
30
30
  "lodash": "^4.17.21",
31
31
  "lru-cache": "^6.0.0",
32
32
  "prop-types": "^15.7.2",
@@ -43,7 +43,16 @@ export default class DatePickerInput extends React.Component {
43
43
  onChange(null);
44
44
  } else {
45
45
  // ensure ONLY the date is persisted - so UTC offset info / time is not persisted or sent
46
- onChange(e.toISOString().split('T')[0]);
46
+ onChange(convertToTimeZoneInsensitiveISOString(e).split('T')[0]);
47
47
  }
48
48
  };
49
49
  }
50
+
51
+ export function convertToTimeZoneInsensitiveISOString(date) {
52
+ const year = new Intl.DateTimeFormat('en', { year: 'numeric' }).format(date);
53
+ const month = new Intl.DateTimeFormat('en', { month: '2-digit' }).format(
54
+ date
55
+ );
56
+ const day = new Intl.DateTimeFormat('en', { day: '2-digit' }).format(date);
57
+ return `${year}-${month}-${day}T00:00:00.000Z`;
58
+ }