Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add finer control over interval range in timetracking view #4604

Merged
merged 5 commits into from
May 14, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released

### Added

-
- Added the possibility to select hour, minute and second of the time range in the timetracking view. [#4604](https://github.com/scalableminds/webknossos/pull/4604)

### Changed

Expand Down
8 changes: 5 additions & 3 deletions frontend/javascripts/admin/time/time_line_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ class TimeLineView extends React.PureComponent<Props, State> {
return;
}

// for same day use start and end timestamps
const dateRange = dates[0].isSame(dates[1], "day")
? [dates[0].startOf("day"), dates[1].endOf("day")]
// Force an interval of at least one minute.
const dateRange = dates[0].isSame(dates[1], "minute")
? [dates[0].startOf("day"), dates[0].add(1, "minute")]
: dates;

await this.setState({ dateRange });
Expand Down Expand Up @@ -300,6 +300,8 @@ class TimeLineView extends React.PureComponent<Props, State> {
</FormItem>
<FormItem {...formItemLayout} label="Date">
<RangePicker
showTime={{ format: "HH:mm" }}
format="YYYY-MM-DD HH:mm"
allowClear={false}
style={{ width: "100%" }}
value={dateRange}
Expand Down