@hipay/hipay-material-ui 2.3.1 → 2.3.3
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/HiCell/CellDate.js +2 -4
- package/HiDatePicker/HiDatePicker.js +3 -4
- package/HiDatePicker/HiDateRangePicker.js +34 -38
- package/HiDatePicker/HiDateRangeSelector.js +24 -43
- package/HiIcon/HiIcon.js +6 -2
- package/es/HiCell/CellDate.js +2 -4
- package/es/HiDatePicker/HiDatePicker.js +3 -4
- package/es/HiDatePicker/HiDateRangePicker.js +34 -38
- package/es/HiDatePicker/HiDateRangeSelector.js +24 -43
- package/es/HiIcon/HiIcon.js +6 -2
- package/es/hi-svg-icons/HiAccount.js +3 -2
- package/es/hi-svg-icons/HiActivity.js +3 -2
- package/es/hi-svg-icons/HiAll.js +3 -2
- package/es/hi-svg-icons/HiBilling.js +3 -2
- package/es/hi-svg-icons/HiBriefcaseRescue.js +3 -2
- package/es/hi-svg-icons/HiCatalog.js +3 -2
- package/es/hi-svg-icons/HiCustomer.js +3 -2
- package/es/hi-svg-icons/HiDownload.js +12 -4
- package/es/hi-svg-icons/HiFinance.js +3 -2
- package/es/hi-svg-icons/HiPermission.js +3 -2
- package/es/hi-svg-icons/HiRoute.js +3 -2
- package/es/hi-svg-icons/HiSettlement.js +3 -2
- package/es/hi-svg-icons/HiTransaction.js +3 -2
- package/es/hi-svg-icons/HiUser.js +3 -2
- package/es/hi-svg-icons/HiWidget.js +3 -2
- package/hi-svg-icons/HiAccount.js +3 -2
- package/hi-svg-icons/HiActivity.js +3 -2
- package/hi-svg-icons/HiAll.js +3 -2
- package/hi-svg-icons/HiBilling.js +3 -2
- package/hi-svg-icons/HiBriefcaseRescue.js +3 -2
- package/hi-svg-icons/HiCatalog.js +3 -2
- package/hi-svg-icons/HiCustomer.js +3 -2
- package/hi-svg-icons/HiDownload.js +12 -4
- package/hi-svg-icons/HiFinance.js +3 -2
- package/hi-svg-icons/HiPermission.js +3 -2
- package/hi-svg-icons/HiRoute.js +3 -2
- package/hi-svg-icons/HiSettlement.js +3 -2
- package/hi-svg-icons/HiTransaction.js +3 -2
- package/hi-svg-icons/HiUser.js +3 -2
- package/hi-svg-icons/HiWidget.js +3 -2
- package/package.json +5 -4
package/HiCell/CellDate.js
CHANGED
@@ -19,9 +19,7 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inhe
|
|
19
19
|
|
20
20
|
var _react = _interopRequireDefault(require("react"));
|
21
21
|
|
22
|
-
var
|
23
|
-
|
24
|
-
require("moment/locale/fr");
|
22
|
+
var _momentTimezone = _interopRequireDefault(require("moment-timezone"));
|
25
23
|
|
26
24
|
var _styles = require("@material-ui/core/styles");
|
27
25
|
|
@@ -72,7 +70,7 @@ function (_React$PureComponent) {
|
|
72
70
|
view = _this$props.view,
|
73
71
|
formatShort = _this$props.formatShort;
|
74
72
|
if (!date) return '';
|
75
|
-
var mdate = (0,
|
73
|
+
var mdate = (0, _momentTimezone.default)(date);
|
76
74
|
mdate.locale(locale);
|
77
75
|
var label;
|
78
76
|
|
@@ -87,7 +87,7 @@ function (_React$Component) {
|
|
87
87
|
};
|
88
88
|
|
89
89
|
_this.handleReset = function () {
|
90
|
-
var today = (0, _momentTimezone.default)()
|
90
|
+
var today = (0, _momentTimezone.default)();
|
91
91
|
|
92
92
|
_this.handleCurrentMonthChange(new Date(today.year(), today.month(), today.date(), today.hours(), today.minutes(), today.seconds(), today.milliseconds()));
|
93
93
|
|
@@ -227,7 +227,7 @@ function (_React$Component) {
|
|
227
227
|
}, yearPickerProps, propsOverlay));
|
228
228
|
};
|
229
229
|
|
230
|
-
var _today = (0, _momentTimezone.default)()
|
230
|
+
var _today = (0, _momentTimezone.default)();
|
231
231
|
|
232
232
|
_this.state = {
|
233
233
|
openedPanel: 'calendar',
|
@@ -261,7 +261,7 @@ function (_React$Component) {
|
|
261
261
|
hideOnDayClick = _this$props.hideOnDayClick,
|
262
262
|
props = (0, _objectWithoutProperties2.default)(_this$props, ["classes", "disabledDays", "disablePastDays", "disableFutureDays", "enableTime", "format", "locale", "minimumDate", "onReset", "translations", "value", "hideOnDayClick"]);
|
263
263
|
var currentMonth = this.state.currentMonth;
|
264
|
-
var today = (0, _momentTimezone.default)()
|
264
|
+
var today = (0, _momentTimezone.default)();
|
265
265
|
var effectiveDisabledDays = (0, _objectSpread2.default)({}, disablePastDays && {
|
266
266
|
before: new Date(today.year(), today.month(), today.date(), today.hours(), today.minutes(), today.seconds(), today.milliseconds())
|
267
267
|
}, {}, disableFutureDays && {
|
@@ -359,7 +359,6 @@ HiDatePicker.defaultProps = {
|
|
359
359
|
locale: 'fr-FR',
|
360
360
|
minimumDate: new Date(2013, 4, 1),
|
361
361
|
// by default 1 May 2013
|
362
|
-
timezoneName: 'Europe/Paris',
|
363
362
|
translations: {
|
364
363
|
today: 'today'
|
365
364
|
}
|
@@ -110,7 +110,7 @@ function (_React$Component) {
|
|
110
110
|
|
111
111
|
_this.onDayToClick = function (day) {
|
112
112
|
var change = (0, _momentTimezone.default)(day) >= (0, _momentTimezone.default)(_this.props.from);
|
113
|
-
var today = (0, _momentTimezone.default)()
|
113
|
+
var today = (0, _momentTimezone.default)();
|
114
114
|
var todayDate = new Date(today.year(), today.month(), today.date(), 23, 59, 59);
|
115
115
|
|
116
116
|
if (change && day > todayDate) {
|
@@ -143,17 +143,15 @@ function (_React$Component) {
|
|
143
143
|
};
|
144
144
|
|
145
145
|
_this.handleChange = function (name, day) {
|
146
|
-
var
|
147
|
-
translations = _this$props.translations,
|
148
|
-
timezoneName = _this$props.timezoneName;
|
146
|
+
var translations = _this.props.translations;
|
149
147
|
var date;
|
150
148
|
var error;
|
151
|
-
var today = (0, _momentTimezone.default)()
|
149
|
+
var today = (0, _momentTimezone.default)();
|
152
150
|
var now = new Date(today.year(), today.month(), today.date(), 23, 59, 59);
|
153
|
-
var _this$
|
154
|
-
minimumDate = _this$
|
155
|
-
disableFutureDays = _this$
|
156
|
-
format = _this$
|
151
|
+
var _this$props = _this.props,
|
152
|
+
minimumDate = _this$props.minimumDate,
|
153
|
+
disableFutureDays = _this$props.disableFutureDays,
|
154
|
+
format = _this$props.format;
|
157
155
|
|
158
156
|
if (day instanceof Date) {
|
159
157
|
date = day;
|
@@ -175,7 +173,7 @@ function (_React$Component) {
|
|
175
173
|
} else if ((0, _momentTimezone.default)(date).utc() < (0, _momentTimezone.default)(minimumDate).utc().startOf('day')) {
|
176
174
|
error = translations.date_inferior_min_date.replace('%s', (0, _momentTimezone.default)(minimumDate).format(format));
|
177
175
|
} else if (disableFutureDays && date > now) {
|
178
|
-
error = translations.date_superior_max_date.replace('%s', (0, _momentTimezone.default)().
|
176
|
+
error = translations.date_superior_max_date.replace('%s', (0, _momentTimezone.default)().format(format));
|
179
177
|
}
|
180
178
|
|
181
179
|
if (!_this.props.enableTime) {
|
@@ -369,7 +367,7 @@ function (_React$Component) {
|
|
369
367
|
}, yearPickerProps, propsOverlay));
|
370
368
|
};
|
371
369
|
|
372
|
-
var _today = (0, _momentTimezone.default)()
|
370
|
+
var _today = (0, _momentTimezone.default)();
|
373
371
|
|
374
372
|
_this.state = {
|
375
373
|
currentMonth: new Date(_today.year(), _today.month(), _today.date()),
|
@@ -390,32 +388,31 @@ function (_React$Component) {
|
|
390
388
|
var _this2 = this,
|
391
389
|
_classNames;
|
392
390
|
|
393
|
-
var _this$
|
394
|
-
classes = _this$
|
395
|
-
disabled = _this$
|
396
|
-
disabledDays = _this$
|
397
|
-
disableFutureDays = _this$
|
398
|
-
enableTime = _this$
|
399
|
-
labelFrom = _this$
|
400
|
-
labelTo = _this$
|
401
|
-
locale = _this$
|
402
|
-
format = _this$
|
403
|
-
from = _this$
|
404
|
-
fromError = _this$
|
405
|
-
minimumDate = _this$
|
406
|
-
onReset = _this$
|
407
|
-
to = _this$
|
408
|
-
toError = _this$
|
409
|
-
translations = _this$
|
410
|
-
id = _this$
|
411
|
-
staticPosition = _this$
|
412
|
-
errorText = _this$
|
413
|
-
hasSelector = _this$
|
414
|
-
helperIcon = _this$
|
415
|
-
helperText = _this$
|
416
|
-
|
417
|
-
|
418
|
-
var today = (0, _momentTimezone.default)().tz(timezoneName);
|
391
|
+
var _this$props2 = this.props,
|
392
|
+
classes = _this$props2.classes,
|
393
|
+
disabled = _this$props2.disabled,
|
394
|
+
disabledDays = _this$props2.disabledDays,
|
395
|
+
disableFutureDays = _this$props2.disableFutureDays,
|
396
|
+
enableTime = _this$props2.enableTime,
|
397
|
+
labelFrom = _this$props2.labelFrom,
|
398
|
+
labelTo = _this$props2.labelTo,
|
399
|
+
locale = _this$props2.locale,
|
400
|
+
format = _this$props2.format,
|
401
|
+
from = _this$props2.from,
|
402
|
+
fromError = _this$props2.fromError,
|
403
|
+
minimumDate = _this$props2.minimumDate,
|
404
|
+
onReset = _this$props2.onReset,
|
405
|
+
to = _this$props2.to,
|
406
|
+
toError = _this$props2.toError,
|
407
|
+
translations = _this$props2.translations,
|
408
|
+
id = _this$props2.id,
|
409
|
+
staticPosition = _this$props2.staticPosition,
|
410
|
+
errorText = _this$props2.errorText,
|
411
|
+
hasSelector = _this$props2.hasSelector,
|
412
|
+
helperIcon = _this$props2.helperIcon,
|
413
|
+
helperText = _this$props2.helperText,
|
414
|
+
props = (0, _objectWithoutProperties2.default)(_this$props2, ["classes", "disabled", "disabledDays", "disableFutureDays", "enableTime", "labelFrom", "labelTo", "locale", "format", "from", "fromError", "minimumDate", "onReset", "to", "toError", "translations", "id", "staticPosition", "errorText", "hasSelector", "helperIcon", "helperText"]);
|
415
|
+
var today = (0, _momentTimezone.default)();
|
419
416
|
var now = new Date(today.year(), today.month(), today.date(), 23, 59, 59, 999);
|
420
417
|
var modifiers = (0, _defineProperty2.default)({
|
421
418
|
start: from,
|
@@ -636,7 +633,6 @@ HiDateRangePicker.defaultProps = {
|
|
636
633
|
locale: 'fr-FR',
|
637
634
|
minimumDate: new Date(2013, 4, 1),
|
638
635
|
// by default 1 May 2013
|
639
|
-
timezoneName: 'Europe/Paris',
|
640
636
|
translations: {
|
641
637
|
today: 'today',
|
642
638
|
hour: 'Hour',
|
@@ -89,87 +89,81 @@ function yearAndQuarter(format, date, t) {
|
|
89
89
|
return indexY < indexM ? date.format("".concat(split[indexY]).concat(s, "[").concat(t.short_quarter, "]Q")) : date.format("[".concat(t.short_quarter, "]Q").concat(s).concat(split[indexY]));
|
90
90
|
}
|
91
91
|
|
92
|
-
function buildDateRangeOptionByKey(key, t, format
|
92
|
+
function buildDateRangeOptionByKey(key, t, format) {
|
93
93
|
var from;
|
94
94
|
var label;
|
95
95
|
var info;
|
96
96
|
var to;
|
97
97
|
var type;
|
98
98
|
|
99
|
-
_momentTimezone.default.updateLocale('en', {
|
100
|
-
week: {
|
101
|
-
dow: 1
|
102
|
-
}
|
103
|
-
});
|
104
|
-
|
105
99
|
switch (key) {
|
106
100
|
case 'custom':
|
107
101
|
label = t.custom_period;
|
108
|
-
from = (0, _momentTimezone.default)().
|
109
|
-
to = (0, _momentTimezone.default)().
|
102
|
+
from = (0, _momentTimezone.default)().subtract(15, 'day').startOf('day');
|
103
|
+
to = (0, _momentTimezone.default)().endOf('day');
|
110
104
|
type = 'primary-highlight';
|
111
105
|
break;
|
112
106
|
|
113
107
|
case 'cd':
|
114
108
|
label = t.today;
|
115
|
-
from = (0, _momentTimezone.default)().
|
116
|
-
to = (0, _momentTimezone.default)().
|
109
|
+
from = (0, _momentTimezone.default)().startOf('day');
|
110
|
+
to = (0, _momentTimezone.default)().endOf('day');
|
117
111
|
info = "".concat(from.format(format));
|
118
112
|
break;
|
119
113
|
|
120
114
|
case 'pd':
|
121
115
|
label = t.yesterday;
|
122
|
-
from = (0, _momentTimezone.default)().
|
123
|
-
to = (0, _momentTimezone.default)().
|
116
|
+
from = (0, _momentTimezone.default)().subtract(1, 'day').startOf('day');
|
117
|
+
to = (0, _momentTimezone.default)().subtract(1, 'day').endOf('day');
|
124
118
|
info = "".concat(from.format(format));
|
125
119
|
break;
|
126
120
|
|
127
121
|
case 'cw':
|
128
122
|
label = t.current_week;
|
129
|
-
from = (0, _momentTimezone.default)().
|
130
|
-
to = (0, _momentTimezone.default)()
|
123
|
+
from = (0, _momentTimezone.default)().startOf('week');
|
124
|
+
to = (0, _momentTimezone.default)();
|
131
125
|
info = "".concat(t.short_week).concat(from.format('w'), ", \n ").concat(from.format(format), " ").concat(t.to_now);
|
132
126
|
break;
|
133
127
|
|
134
128
|
case 'pw':
|
135
129
|
label = t.previous_week;
|
136
|
-
from = (0, _momentTimezone.default)().
|
137
|
-
to = (0, _momentTimezone.default)().
|
130
|
+
from = (0, _momentTimezone.default)().subtract(1, 'week').startOf('week');
|
131
|
+
to = (0, _momentTimezone.default)().subtract(1, 'week').endOf('week');
|
138
132
|
info = "".concat(t.short_week).concat(from.format('w'), ", ").concat(from.format(format), " ").concat(t.to, " ").concat(to.format(format));
|
139
133
|
break;
|
140
134
|
|
141
135
|
case 'cm':
|
142
136
|
label = t.current_month;
|
143
|
-
from = (0, _momentTimezone.default)().
|
144
|
-
to = (0, _momentTimezone.default)()
|
137
|
+
from = (0, _momentTimezone.default)().startOf('month');
|
138
|
+
to = (0, _momentTimezone.default)();
|
145
139
|
info = "".concat(from.format(format), " ").concat(t.to_now, ", ").concat(to.diff(from, 'days') + 1, " ").concat(t.days);
|
146
140
|
break;
|
147
141
|
|
148
142
|
case 'pm':
|
149
143
|
label = t.previous_month;
|
150
|
-
from = (0, _momentTimezone.default)().
|
151
|
-
to = (0, _momentTimezone.default)().
|
144
|
+
from = (0, _momentTimezone.default)().subtract(1, 'month').startOf('month');
|
145
|
+
to = (0, _momentTimezone.default)().subtract(1, 'month').endOf('month');
|
152
146
|
info = "".concat(yearAndMonth(format, from), ", ").concat(from.daysInMonth(), " ").concat(t.days);
|
153
147
|
break;
|
154
148
|
|
155
149
|
case 'cq':
|
156
150
|
label = t.current_quarter;
|
157
|
-
from = (0, _momentTimezone.default)().
|
158
|
-
to = (0, _momentTimezone.default)()
|
151
|
+
from = (0, _momentTimezone.default)().startOf('quarter');
|
152
|
+
to = (0, _momentTimezone.default)();
|
159
153
|
info = "".concat(yearAndQuarter(format, from, t), ", ").concat(from.format(format), " ").concat(t.to_now, ", ").concat(to.diff(from, 'days') + 1, " ").concat(t.days);
|
160
154
|
break;
|
161
155
|
|
162
156
|
case 'pq':
|
163
157
|
label = t.previous_quarter;
|
164
|
-
from = (0, _momentTimezone.default)().
|
165
|
-
to = (0, _momentTimezone.default)().
|
158
|
+
from = (0, _momentTimezone.default)().subtract(1, 'quarter').startOf('quarter');
|
159
|
+
to = (0, _momentTimezone.default)().subtract(1, 'quarter').endOf('quarter');
|
166
160
|
info = "".concat(yearAndQuarter(format, from, t), ", ").concat(to.diff(from, 'days') + 1, " ").concat(t.days);
|
167
161
|
break;
|
168
162
|
|
169
163
|
case 'cy':
|
170
164
|
label = t.current_year;
|
171
|
-
from = (0, _momentTimezone.default)().
|
172
|
-
to = (0, _momentTimezone.default)()
|
165
|
+
from = (0, _momentTimezone.default)().startOf('year');
|
166
|
+
to = (0, _momentTimezone.default)();
|
173
167
|
info = "".concat(from.format(format), " ").concat(t.to_now, ", ").concat(to.diff(from, 'days') + 1, " ").concat(t.days);
|
174
168
|
break;
|
175
169
|
|
@@ -268,7 +262,7 @@ function (_React$Component) {
|
|
268
262
|
};
|
269
263
|
|
270
264
|
_this.options = props.availableOptionKeys.map(function (key) {
|
271
|
-
return buildDateRangeOptionByKey(key, props.translations, props.format
|
265
|
+
return buildDateRangeOptionByKey(key, props.translations, props.format);
|
272
266
|
});
|
273
267
|
_this.state = {
|
274
268
|
selectedPreset: props.defaultPreset,
|
@@ -286,18 +280,6 @@ function (_React$Component) {
|
|
286
280
|
});
|
287
281
|
}
|
288
282
|
}
|
289
|
-
}, {
|
290
|
-
key: "componentDidUpdate",
|
291
|
-
value: function componentDidUpdate(prevProps) {
|
292
|
-
var _this2 = this;
|
293
|
-
|
294
|
-
if (prevProps.timezoneName !== this.props.timezoneName) {
|
295
|
-
this.options = this.props.availableOptionKeys.map(function (key) {
|
296
|
-
return buildDateRangeOptionByKey(key, _this2.props.translations, _this2.props.format, _this2.props.timezoneName);
|
297
|
-
});
|
298
|
-
this.updateDates(this.state.selectedPreset);
|
299
|
-
}
|
300
|
-
}
|
301
283
|
}, {
|
302
284
|
key: "componentWillUnmount",
|
303
285
|
value: function componentWillUnmount() {
|
@@ -324,7 +306,7 @@ function (_React$Component) {
|
|
324
306
|
}, {
|
325
307
|
key: "render",
|
326
308
|
value: function render() {
|
327
|
-
var
|
309
|
+
var _this2 = this;
|
328
310
|
|
329
311
|
var _this$props = this.props,
|
330
312
|
disabled = _this$props.disabled,
|
@@ -369,7 +351,7 @@ function (_React$Component) {
|
|
369
351
|
flexDirection: 'column'
|
370
352
|
} : {},
|
371
353
|
ref: function ref(container) {
|
372
|
-
|
354
|
+
_this2.container = container;
|
373
355
|
}
|
374
356
|
}, _react.default.createElement("div", {
|
375
357
|
className: classes.select,
|
@@ -444,7 +426,6 @@ HiDateRangeSelector.defaultProps = {
|
|
444
426
|
format: 'YYYY-DD-MM',
|
445
427
|
minimumDate: new Date(2013, 4, 1),
|
446
428
|
// by default 1 May 2013
|
447
|
-
timezoneName: 'Europe/Paris',
|
448
429
|
translations: {
|
449
430
|
today: 'Today',
|
450
431
|
hour: 'Hour',
|
package/HiIcon/HiIcon.js
CHANGED
@@ -46,7 +46,7 @@ var useStyles = (0, _styles.makeStyles)(function (theme) {
|
|
46
46
|
});
|
47
47
|
exports.useStyles = useStyles;
|
48
48
|
|
49
|
-
|
49
|
+
var HiIcon = _react.default.forwardRef(function (props, ref) {
|
50
50
|
var children = props.children,
|
51
51
|
className = props.className,
|
52
52
|
icon = props.icon,
|
@@ -60,6 +60,7 @@ function HiIcon(props) {
|
|
60
60
|
|
61
61
|
if (iconName && iconName.indexOf('fa-') === 0) {
|
62
62
|
return _react.default.createElement("i", (0, _extends2.default)({
|
63
|
+
ref: ref,
|
63
64
|
className: (0, _classnames.default)('fa', iconName, className, classes.root),
|
64
65
|
style: {
|
65
66
|
fontSize: size
|
@@ -71,6 +72,7 @@ function HiIcon(props) {
|
|
71
72
|
if (iconName && iconName.indexOf('hi_') === 0) {
|
72
73
|
var IconName = hiSvgIcons[(0, _helpers.capitalize)((0, _helpers.camelize)(iconName))];
|
73
74
|
return _react.default.createElement(IconName, (0, _extends2.default)({
|
75
|
+
ref: ref,
|
74
76
|
className: (0, _classnames.default)(classes.root, className),
|
75
77
|
color: color,
|
76
78
|
size: size
|
@@ -87,6 +89,7 @@ function HiIcon(props) {
|
|
87
89
|
if (iconName && iconName.indexOf('mdi_') === 0) {
|
88
90
|
var _IconName = mdi[(0, _helpers.capitalize)((0, _helpers.camelize)(iconName.slice(4)))];
|
89
91
|
return _react.default.createElement(_IconName, (0, _extends2.default)({
|
92
|
+
ref: ref,
|
90
93
|
className: (0, _classnames.default)(classes.root, className),
|
91
94
|
color: color,
|
92
95
|
style: {
|
@@ -97,13 +100,14 @@ function HiIcon(props) {
|
|
97
100
|
|
98
101
|
|
99
102
|
return _react.default.createElement(_Icon.default, (0, _extends2.default)({
|
103
|
+
ref: ref,
|
100
104
|
className: (0, _classnames.default)(classes.root, className),
|
101
105
|
color: color,
|
102
106
|
style: {
|
103
107
|
fontSize: size
|
104
108
|
}
|
105
109
|
}, other), iconName);
|
106
|
-
}
|
110
|
+
});
|
107
111
|
|
108
112
|
HiIcon.defaultProps = {
|
109
113
|
color: 'neutral',
|
package/es/HiCell/CellDate.js
CHANGED
@@ -19,9 +19,7 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inhe
|
|
19
19
|
|
20
20
|
var _react = _interopRequireDefault(require("react"));
|
21
21
|
|
22
|
-
var
|
23
|
-
|
24
|
-
require("moment/locale/fr");
|
22
|
+
var _momentTimezone = _interopRequireDefault(require("moment-timezone"));
|
25
23
|
|
26
24
|
var _styles = require("@material-ui/core/styles");
|
27
25
|
|
@@ -72,7 +70,7 @@ function (_React$PureComponent) {
|
|
72
70
|
view = _this$props.view,
|
73
71
|
formatShort = _this$props.formatShort;
|
74
72
|
if (!date) return '';
|
75
|
-
var mdate = (0,
|
73
|
+
var mdate = (0, _momentTimezone.default)(date);
|
76
74
|
mdate.locale(locale);
|
77
75
|
var label;
|
78
76
|
|
@@ -87,7 +87,7 @@ function (_React$Component) {
|
|
87
87
|
};
|
88
88
|
|
89
89
|
_this.handleReset = function () {
|
90
|
-
var today = (0, _momentTimezone.default)()
|
90
|
+
var today = (0, _momentTimezone.default)();
|
91
91
|
|
92
92
|
_this.handleCurrentMonthChange(new Date(today.year(), today.month(), today.date(), today.hours(), today.minutes(), today.seconds(), today.milliseconds()));
|
93
93
|
|
@@ -227,7 +227,7 @@ function (_React$Component) {
|
|
227
227
|
}, yearPickerProps, propsOverlay));
|
228
228
|
};
|
229
229
|
|
230
|
-
var _today = (0, _momentTimezone.default)()
|
230
|
+
var _today = (0, _momentTimezone.default)();
|
231
231
|
|
232
232
|
_this.state = {
|
233
233
|
openedPanel: 'calendar',
|
@@ -261,7 +261,7 @@ function (_React$Component) {
|
|
261
261
|
hideOnDayClick = _this$props.hideOnDayClick,
|
262
262
|
props = (0, _objectWithoutProperties2.default)(_this$props, ["classes", "disabledDays", "disablePastDays", "disableFutureDays", "enableTime", "format", "locale", "minimumDate", "onReset", "translations", "value", "hideOnDayClick"]);
|
263
263
|
var currentMonth = this.state.currentMonth;
|
264
|
-
var today = (0, _momentTimezone.default)()
|
264
|
+
var today = (0, _momentTimezone.default)();
|
265
265
|
var effectiveDisabledDays = (0, _objectSpread2.default)({}, disablePastDays && {
|
266
266
|
before: new Date(today.year(), today.month(), today.date(), today.hours(), today.minutes(), today.seconds(), today.milliseconds())
|
267
267
|
}, {}, disableFutureDays && {
|
@@ -359,7 +359,6 @@ HiDatePicker.defaultProps = {
|
|
359
359
|
locale: 'fr-FR',
|
360
360
|
minimumDate: new Date(2013, 4, 1),
|
361
361
|
// by default 1 May 2013
|
362
|
-
timezoneName: 'Europe/Paris',
|
363
362
|
translations: {
|
364
363
|
today: 'today'
|
365
364
|
}
|
@@ -110,7 +110,7 @@ function (_React$Component) {
|
|
110
110
|
|
111
111
|
_this.onDayToClick = function (day) {
|
112
112
|
var change = (0, _momentTimezone.default)(day) >= (0, _momentTimezone.default)(_this.props.from);
|
113
|
-
var today = (0, _momentTimezone.default)()
|
113
|
+
var today = (0, _momentTimezone.default)();
|
114
114
|
var todayDate = new Date(today.year(), today.month(), today.date(), 23, 59, 59);
|
115
115
|
|
116
116
|
if (change && day > todayDate) {
|
@@ -143,17 +143,15 @@ function (_React$Component) {
|
|
143
143
|
};
|
144
144
|
|
145
145
|
_this.handleChange = function (name, day) {
|
146
|
-
var
|
147
|
-
translations = _this$props.translations,
|
148
|
-
timezoneName = _this$props.timezoneName;
|
146
|
+
var translations = _this.props.translations;
|
149
147
|
var date;
|
150
148
|
var error;
|
151
|
-
var today = (0, _momentTimezone.default)()
|
149
|
+
var today = (0, _momentTimezone.default)();
|
152
150
|
var now = new Date(today.year(), today.month(), today.date(), 23, 59, 59);
|
153
|
-
var _this$
|
154
|
-
minimumDate = _this$
|
155
|
-
disableFutureDays = _this$
|
156
|
-
format = _this$
|
151
|
+
var _this$props = _this.props,
|
152
|
+
minimumDate = _this$props.minimumDate,
|
153
|
+
disableFutureDays = _this$props.disableFutureDays,
|
154
|
+
format = _this$props.format;
|
157
155
|
|
158
156
|
if (day instanceof Date) {
|
159
157
|
date = day;
|
@@ -175,7 +173,7 @@ function (_React$Component) {
|
|
175
173
|
} else if ((0, _momentTimezone.default)(date).utc() < (0, _momentTimezone.default)(minimumDate).utc().startOf('day')) {
|
176
174
|
error = translations.date_inferior_min_date.replace('%s', (0, _momentTimezone.default)(minimumDate).format(format));
|
177
175
|
} else if (disableFutureDays && date > now) {
|
178
|
-
error = translations.date_superior_max_date.replace('%s', (0, _momentTimezone.default)().
|
176
|
+
error = translations.date_superior_max_date.replace('%s', (0, _momentTimezone.default)().format(format));
|
179
177
|
}
|
180
178
|
|
181
179
|
if (!_this.props.enableTime) {
|
@@ -369,7 +367,7 @@ function (_React$Component) {
|
|
369
367
|
}, yearPickerProps, propsOverlay));
|
370
368
|
};
|
371
369
|
|
372
|
-
var _today = (0, _momentTimezone.default)()
|
370
|
+
var _today = (0, _momentTimezone.default)();
|
373
371
|
|
374
372
|
_this.state = {
|
375
373
|
currentMonth: new Date(_today.year(), _today.month(), _today.date()),
|
@@ -390,32 +388,31 @@ function (_React$Component) {
|
|
390
388
|
var _this2 = this,
|
391
389
|
_classNames;
|
392
390
|
|
393
|
-
var _this$
|
394
|
-
classes = _this$
|
395
|
-
disabled = _this$
|
396
|
-
disabledDays = _this$
|
397
|
-
disableFutureDays = _this$
|
398
|
-
enableTime = _this$
|
399
|
-
labelFrom = _this$
|
400
|
-
labelTo = _this$
|
401
|
-
locale = _this$
|
402
|
-
format = _this$
|
403
|
-
from = _this$
|
404
|
-
fromError = _this$
|
405
|
-
minimumDate = _this$
|
406
|
-
onReset = _this$
|
407
|
-
to = _this$
|
408
|
-
toError = _this$
|
409
|
-
translations = _this$
|
410
|
-
id = _this$
|
411
|
-
staticPosition = _this$
|
412
|
-
errorText = _this$
|
413
|
-
hasSelector = _this$
|
414
|
-
helperIcon = _this$
|
415
|
-
helperText = _this$
|
416
|
-
|
417
|
-
|
418
|
-
var today = (0, _momentTimezone.default)().tz(timezoneName);
|
391
|
+
var _this$props2 = this.props,
|
392
|
+
classes = _this$props2.classes,
|
393
|
+
disabled = _this$props2.disabled,
|
394
|
+
disabledDays = _this$props2.disabledDays,
|
395
|
+
disableFutureDays = _this$props2.disableFutureDays,
|
396
|
+
enableTime = _this$props2.enableTime,
|
397
|
+
labelFrom = _this$props2.labelFrom,
|
398
|
+
labelTo = _this$props2.labelTo,
|
399
|
+
locale = _this$props2.locale,
|
400
|
+
format = _this$props2.format,
|
401
|
+
from = _this$props2.from,
|
402
|
+
fromError = _this$props2.fromError,
|
403
|
+
minimumDate = _this$props2.minimumDate,
|
404
|
+
onReset = _this$props2.onReset,
|
405
|
+
to = _this$props2.to,
|
406
|
+
toError = _this$props2.toError,
|
407
|
+
translations = _this$props2.translations,
|
408
|
+
id = _this$props2.id,
|
409
|
+
staticPosition = _this$props2.staticPosition,
|
410
|
+
errorText = _this$props2.errorText,
|
411
|
+
hasSelector = _this$props2.hasSelector,
|
412
|
+
helperIcon = _this$props2.helperIcon,
|
413
|
+
helperText = _this$props2.helperText,
|
414
|
+
props = (0, _objectWithoutProperties2.default)(_this$props2, ["classes", "disabled", "disabledDays", "disableFutureDays", "enableTime", "labelFrom", "labelTo", "locale", "format", "from", "fromError", "minimumDate", "onReset", "to", "toError", "translations", "id", "staticPosition", "errorText", "hasSelector", "helperIcon", "helperText"]);
|
415
|
+
var today = (0, _momentTimezone.default)();
|
419
416
|
var now = new Date(today.year(), today.month(), today.date(), 23, 59, 59, 999);
|
420
417
|
var modifiers = (0, _defineProperty2.default)({
|
421
418
|
start: from,
|
@@ -636,7 +633,6 @@ HiDateRangePicker.defaultProps = {
|
|
636
633
|
locale: 'fr-FR',
|
637
634
|
minimumDate: new Date(2013, 4, 1),
|
638
635
|
// by default 1 May 2013
|
639
|
-
timezoneName: 'Europe/Paris',
|
640
636
|
translations: {
|
641
637
|
today: 'today',
|
642
638
|
hour: 'Hour',
|