Skip to content

Commit 7601314

Browse files
authored
Merge pull request #123 from InetIntel/revert-122-113-date-picker
Revert "Remove time selection form RangePicker to only select dates"
2 parents 134dd86 + 779b6cd commit 7601314

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

assets/js/Ioda/components/controlPanel/ControlPanel.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,22 +54,15 @@ class ControlPanel extends Component {
5454
this.setState({ customUnit: val });
5555
};
5656

57-
handleRangeChange = ([fromDayjs, untilDayjs], fromRangePicker = false) => {
58-
if (fromRangePicker) {
59-
// Adjust fromDayjs and untilDayjs to start of the day in UTC
60-
fromDayjs = fromDayjs.startOf('day').utc();
61-
untilDayjs = untilDayjs.startOf('day').utc();
62-
}
63-
57+
handleRangeChange = ([fromDayjs, untilDayjs]) => {
6458
this.setState({ range: [fromDayjs, untilDayjs] }, () => {
6559
this.props.onTimeFrameChange({
66-
from: getSeconds(fromDayjs.add(fromDayjs.utcOffset(), 'minute')),
67-
until: getSeconds(untilDayjs.add(untilDayjs.utcOffset(), 'minute')),
60+
from: getSeconds(fromDayjs.add(fromDayjs.utcOffset(), "minute")),
61+
until: getSeconds(untilDayjs.add(untilDayjs.utcOffset(), "minute")),
6862
});
6963
});
7064
};
7165

72-
7366
handleCustomRange = () => {
7467
const { customDuration, customUnit } = this.state;
7568
const from = getNowAsUTC().subtract(customDuration, customUnit);
@@ -242,7 +235,10 @@ class ControlPanel extends Component {
242235
<RangePicker
243236
className="col"
244237
value={this.state.range}
245-
onChange={(dates) => this.handleRangeChange(dates, true)}
238+
showTime={{ format: "h:mmA" }}
239+
format="MMM D YYYY h:mma UTC"
240+
onChange={this.handleRangeChange}
241+
onOk={this.handleRangeChange}
246242
/>
247243
</div>
248244
</div>

0 commit comments

Comments
 (0)