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

Issue with time picker only & fixing range example #2463

Merged
merged 4 commits into from
Jan 11, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions src/docs/partials/examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,7 @@ <h3 id='linked-pickers'>Linked pickers <a class='anchorjs-link ' aria-label='Anc
const subscription = linked2.subscribe(tempusDominus.Namespace.events.change, (e) => {
linked1.updateOptions({
restrictions: {
maxDate: e.detail.date
maxDate: e.date
}
});
});
Expand Down Expand Up @@ -1049,7 +1049,7 @@ <h3 id='linked-pickers'>Linked pickers <a class='anchorjs-link ' aria-label='Anc
const subscription = linked2.subscribe(tempusDominus.Namespace.events.change, (e) => {
linked1.updateOptions({
restrictions: {
maxDate: e.detail.date
maxDate: e.date
}
});
});
Expand Down
17 changes: 10 additions & 7 deletions src/js/display/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,20 +150,23 @@ export default class Display {

this._buildWidget();

// If modeView is only clock
const onlyClock = this._hasTime && !this._hasDate;

// reset the view to the clock if there's no date components
if (this._hasTime && !this._hasDate) {
if (onlyClock) {
this._context._action.do(null, ActionTypes.showClock);
return;
}

// otherwise return to the calendar view
this._context._currentViewMode = this._context._minViewModeNumber;

if (this._hasTime)
Collapse.hide(this._context._display.widget
.getElementsByClassName(Namespace.css.timeContainer)[0] as HTMLElement);
Collapse.show(this._context._display.widget
.getElementsByClassName(Namespace.css.dateContainer)[0] as HTMLElement);
if (!onlyClock) {
if (this._hasTime) {
Collapse.hide(this._context._display.widget.querySelector(`div.${Namespace.css.timeContainer}`));
}
Collapse.show(this._context._display.widget.querySelector(`div.${Namespace.css.dateContainer}`));
}

if (this._hasDate) {
this._showMode();
Expand Down