@dvrd/dvr-controls 1.1.19 → 1.1.20
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dvrd/dvr-controls",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.20",
|
|
4
4
|
"description": "Custom web controls",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"files": [
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
]
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@dvrd/idate": "
|
|
28
|
+
"@dvrd/idate": "*",
|
|
29
29
|
"@fortawesome/fontawesome-svg-core": "*",
|
|
30
30
|
"@fortawesome/free-brands-svg-icons": "*",
|
|
31
31
|
"@fortawesome/free-regular-svg-icons": "*",
|
|
@@ -452,7 +452,7 @@ interface TimePickerProps {
|
|
|
452
452
|
|
|
453
453
|
function TimePicker(props: TimePickerProps) {
|
|
454
454
|
const {onChange, value, open, onClose, timeMode, closeOnChange} = props;
|
|
455
|
-
const internalValue = useRef<IDate>(value ?? new IDate('00:00:00', 'HH:mm:ss'));
|
|
455
|
+
const internalValue = useRef<IDate>(value ?? new IDate('00:00:00', {dateFormat: 'HH:mm:ss', generative: true}));
|
|
456
456
|
|
|
457
457
|
function onClickNow() {
|
|
458
458
|
internalValue.current = IDate.now();
|
|
@@ -500,7 +500,7 @@ function TimePicker(props: TimePickerProps) {
|
|
|
500
500
|
}
|
|
501
501
|
|
|
502
502
|
function renderTimeSwiper(key: 'hour' | 'minute' | 'second') {
|
|
503
|
-
const _value = value ?? new IDate('00:00:00', 'HH:mm:ss');
|
|
503
|
+
const _value = value ?? new IDate('00:00:00', {dateFormat: 'HH:mm:ss'});
|
|
504
504
|
let timeValue: number, numSlides: number;
|
|
505
505
|
if (key === 'hour') {
|
|
506
506
|
timeValue = _value.hours();
|
|
@@ -301,10 +301,10 @@ export default class DateField extends PureComponent<Props, State> {
|
|
|
301
301
|
const {value, dateType} = this.props;
|
|
302
302
|
if (value.length) {
|
|
303
303
|
if (dateType === DateType.DATE)
|
|
304
|
-
return new IDate(value, 'DD-MM-YYYY');
|
|
304
|
+
return new IDate(value, {dateFormat: 'DD-MM-YYYY'});
|
|
305
305
|
if (dateType === DateType.DATETIME)
|
|
306
|
-
return new IDate(value, 'DD-MM-YYYY HH:mm');
|
|
307
|
-
return new IDate(value, 'HH:mm');
|
|
306
|
+
return new IDate(value, {dateFormat: 'DD-MM-YYYY HH:mm'});
|
|
307
|
+
return new IDate(value, {dateFormat: 'HH:mm'});
|
|
308
308
|
}
|
|
309
309
|
return null;
|
|
310
310
|
};
|
|
@@ -152,9 +152,9 @@ export default class DateFieldController<T extends IDateValue> extends PureCompo
|
|
|
152
152
|
// Only call onChange when the date is validly (only containing numbers)
|
|
153
153
|
if (!/[a-zA-Z]/.test(value)) {
|
|
154
154
|
let momentValue: IDate;
|
|
155
|
-
if (dateType === DateType.DATE) momentValue = new IDate(value, 'DD-MM-YYYY');
|
|
156
|
-
else if (dateType === DateType.TIME) momentValue = new IDate(value, 'HH:mm');
|
|
157
|
-
else momentValue = new IDate(value, 'DD-MM-YYYY HH:mm');
|
|
155
|
+
if (dateType === DateType.DATE) momentValue = new IDate(value, {dateFormat: 'DD-MM-YYYY'});
|
|
156
|
+
else if (dateType === DateType.TIME) momentValue = new IDate(value, {dateFormat: 'HH:mm'});
|
|
157
|
+
else momentValue = new IDate(value, {dateFormat: 'DD-MM-YYYY HH:mm'});
|
|
158
158
|
switch (returnType) {
|
|
159
159
|
case DateReturnType.STRING:
|
|
160
160
|
switch (dateType) {
|
|
@@ -173,7 +173,7 @@ export default class DateInput extends PureComponent<Props, State> {
|
|
|
173
173
|
'DD-MM-YYYY HH:mm' : 'HH:mm';
|
|
174
174
|
if (indexes.length >= format.length) {
|
|
175
175
|
const stringValue = this.getStringValue(format.length);
|
|
176
|
-
momentValue = new IDate(stringValue, format);
|
|
176
|
+
momentValue = new IDate(stringValue, {dateFormat: format});
|
|
177
177
|
if (!/[a-zA-Z]/.test(stringValue) && momentValue.isValid()) onChange(momentValue);
|
|
178
178
|
}
|
|
179
179
|
};
|