@momo-kits/date-picker 0.0.24 → 0.0.25
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/datePicker/DatePicker.js
CHANGED
|
@@ -206,7 +206,7 @@ class DatePicker extends Component {
|
|
|
206
206
|
if (format === 'hh:mm' && !isRanged) {
|
|
207
207
|
const valueHours = this.selectedDate ? this.selectedDate?.getHours()?.toString()?.length === 1 ? `0${this.selectedDate.getHours().toString()}` : this.selectedDate?.getHours()?.toString() || '' : '';
|
|
208
208
|
const valueMinute = this.selectedDate ? this.selectedDate?.getMinutes()?.toString()?.length === 1 ? `0${this.selectedDate.getMinutes().toString()}` : this.selectedDate?.getMinutes()?.toString() || '' : '';
|
|
209
|
-
|
|
209
|
+
|
|
210
210
|
this.hourIndex = this.selectedDate
|
|
211
211
|
? this.hours.indexOf(valueHours)
|
|
212
212
|
: this.hours.indexOf(current.getHours().toString().length === 1 ? `0${current.getHours().toString()}` : current.getHours().toString());
|
|
@@ -266,10 +266,9 @@ class DatePicker extends Component {
|
|
|
266
266
|
const day = this.days[this.dayIndex];
|
|
267
267
|
const month = this.months[this.monthIndex];
|
|
268
268
|
const year = this.years[this.yearIndex];
|
|
269
|
-
const hour = this.hours[this.hourIndex];
|
|
270
|
-
const minute = this.minutes[this.minuteIndex];
|
|
269
|
+
const hour = this.hours[this.hourIndex] || '00';
|
|
270
|
+
const minute = this.minutes[this.minuteIndex] || '00';
|
|
271
271
|
const selectedDateFormatted = DatePickerHelper.toString(day, month, year, hour, minute, format);
|
|
272
|
-
|
|
273
272
|
if (onSelected && typeof onSelected === 'function') {
|
|
274
273
|
onSelected(selectedDateFormatted || selectedDate || DatePickerHelper.getCurrentDate(format));
|
|
275
274
|
}
|
|
@@ -15,8 +15,9 @@ export default class WheelPicker extends Component {
|
|
|
15
15
|
constructor(props) {
|
|
16
16
|
super(props);
|
|
17
17
|
const {
|
|
18
|
-
heightItem, value, numberItem, arrayValue
|
|
18
|
+
heightItem, value: valueItem, numberItem, arrayValue
|
|
19
19
|
} = this.props;
|
|
20
|
+
const value = valueItem === -1 ? 0 : valueItem;
|
|
20
21
|
this.heightItem = heightItem;
|
|
21
22
|
this.currentPosition = value * this.heightItem;
|
|
22
23
|
this.prePosition = this.currentPosition;
|