Question

I have pretty straight forward MobiScroll date component initialization code as follows.

function attachMobiDate(id) {
        var now = new Date();
        $('#'+id).mobiscroll().date({
            minDate: new Date(now.getFullYear(), now.getMonth(), now.getDate()),
            dateFormat: 'dd, M yyyy',
            theme: 'android',
            display: 'modal',
            mode: 'scroller',
            startYear: 2000
        });
    }

Everything is working perfectly. The start year is not getting set. The UI only showing me 2013 and 2014. However, if I set 'endYear' to 2020 its working fine. May I now whats going wrong here?

Was it helpful?

Solution

OKay, Found my mistake! :)

minDate: new Date(*now.getFullYear()*, now.getMonth(), now.getDate()),

in the initialization part and again trying to set through 'startYear'.

When I modified minDate as below and removed 'startYear', it worked fine!

minDate: new Date(*now.getFullYear()-10*, now.getMonth(), now.getDate()),
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top