The previous month button does not work since 1.7.0-RC1
Expected behaviour
Using a custom template for left arrow, you should be able to click back a month.
Actual behaviour
It moves forward only
Datepicker version used
1.7.0-RC1 1.6.4 works
related to https://github.com/uxsolutions/bootstrap-datepicker/commit/3e56fdb35872bcb16dfb1dd0d1f32ab03fdfdc64
Example code
Sample of the configuration I am using - the only important bit here is the templates. I am switching the left and right arrow icons.
this.datepicker.datepicker({
orientation: "left auto",
language: this.i18n.getLocale(),
autoclose: true,
clearBtn: false,
todayBtn: "linked",
todayHighlight: true,
templates: {
leftArrow: '<i class="sw-icon-previous"></i>',
rightArrow: '<i class="sw-icon-next"></i>'
},
container: $(this.element).parent(),
startDate: this.startDate,
endData: this.endDate
});
In 1.6.4 the code would try and find the .closest('prev') whereas now the code in navArrowsClick assumes the target of the event is either the 'prev' or 'next' element. However the target is the icon listed in the template. looking at the HTML, we see
<th class="prev"><i class="sw-icon-previous"></i>...</th>
So clicking back always results in a value of +1
I am facing this problem as well with 1.7.0-RC2
Correct. It was introduced in 1.7.0-RC1 where this area was rewritten, but it still exists in latest
On Apr 6, 2017 10:38 AM, "rgins16" [email protected] wrote:
I am facing this problem as well with 1.7.0-RC2
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/uxsolutions/bootstrap-datepicker/issues/2159#issuecomment-292194829, or mute the thread https://github.com/notifications/unsubscribe-auth/ADEpfhEh_6AwUzzsKFlP0SIsoY6ky8SNks5rtPjNgaJpZM4MwZBf .
@vsn4ik it looks like it's related to your changes from #2116. Can you please take a look? Thanks!
Datepicker version used
1.6.4
Issue
(only reproducible when using minified file) Selecting the Left Arrow date picker moves forward only
When there is an endDate set the leftArrow performs a .next function, rather than .prev.
(ref. bootstrap-datepicker.js line 1184)
Again: this only happens when using the minified file.
var MIN_DATE = new Date("1/1/2008");
var MAX_DATE = new Date("12/15/2016");
var options = {
clearBtn: true,
orientation: "bottom auto",
defaultViewDate: MAX_DATE,
startDate: MIN_DATE,
endDate: MAX_DATE,
templates: {
leftArrow: '<i class="fa fa-chevron-circle-left"></i>',
rightArrow: '<i class="fa fa-chevron-circle-right"></i>'
},
};
$('#datepicker2').datepicker(options);
@jadrake75 Thanks! Please, check your problem on https://codepen.io/anon/pen/jGzowm?editors=1010.
@vsn4ik yes that seems to have addressed it - sorry for taking so long to confirm