bootstrap-datepicker icon indicating copy to clipboard operation
bootstrap-datepicker copied to clipboard

The previous month button does not work since 1.7.0-RC1

Open jadrake75 opened this issue 9 years ago • 6 comments

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

jadrake75 avatar Apr 01 '17 06:04 jadrake75

I am facing this problem as well with 1.7.0-RC2

rgins16 avatar Apr 06 '17 14:04 rgins16

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 .

jadrake75 avatar Apr 06 '17 14:04 jadrake75

@vsn4ik it looks like it's related to your changes from #2116. Can you please take a look? Thanks!

acrobat avatar Apr 07 '17 06:04 acrobat

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);

jetsquared avatar May 13 '17 14:05 jetsquared

@jadrake75 Thanks! Please, check your problem on https://codepen.io/anon/pen/jGzowm?editors=1010.

vsn4ik avatar Oct 09 '17 15:10 vsn4ik

@vsn4ik yes that seems to have addressed it - sorry for taking so long to confirm

jadrake75 avatar Nov 04 '17 22:11 jadrake75