Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Datepicker shows selected date when opened #1672

Merged

Conversation

kevinparkerson
Copy link
Contributor

fixes #1671 by having the calendar with the selected date visible when the datepicker is shown. If no selected date is present today's date is used.

Also adds show and hide methods, along with 'shown' and 'hidden' events. These will need to be documented.

Unit tests have been added to accompany these additions.

I've funneled all entry and exit points through the show and hide methods. I wanted to make use of show.bs.dropdown instead of shown.bs.dropdown (in order to switch the calendar screen before the dropdown was made visible) but could not due to a bug with Bootstrap's dropdown (https://github.com/twbs/bootstrap/blob/master/js/dropdown.js#L80 should be return false;). That bug is unlikely to be fixed, so shown.bs.dropdown will have to do. There is no visible impact anyway since the calendar screen renders very quickly (it's the same thing used when switching months)

…n the datepicker is shown. If no selected date is present today's date is used.

Also adds show and hide methods, along with 'shown' and 'hidden' events
if (!this.$input.is(':focus')){
this.$element.find('.input-group-btn').addClass('open');
show: function () {
var date = (this.selectedDate) ? this.selectedDate : new Date();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.selectedDate || new Date() Or Gate

swilliamset added a commit that referenced this pull request Jan 13, 2016
…cted

Datepicker shows selected date when opened
@swilliamset swilliamset merged commit f0de267 into ExactTarget:master Jan 13, 2016
@swilliamset swilliamset modified the milestones: 3.14.0, 3.13.1 Jan 13, 2016
@swilliamset
Copy link
Contributor

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Datepicker needs to revert to selected position on close if a selection has been made
2 participants