Issue with invalid dates [Range script]

I´m trying to include “w0” as invalid on Range script but parameter “w0” works only in past dates.

I´ve tested w1, w2 (…) w6 and it´s everything ok, the bug occurs only with ‘w0’ on future dates.

Check attached gif please.

I´m using Windows 10 + Chrome 70.0.3538.77 64bits

http://staging.getmalas.com.br/webapp
At address field, type “Av Prudente de Morais Belo” and pick first option

Then will appear datepicker

  $(document).ready(function() {

// Mobiscroll
$('#demo').mobiscroll().range({
  startInput: '#start',
  endInput: '#end',
  //min: min_date,
  fromText: 'Receber em',
  toText: 'Devolver em',
  minRange: 5 * day, // Revisar duracao minima
  labels: [
    {
      d: '12/25',
      text: 'Natal',
      color: 'red'
    },
    {
      d: '1/1',
      text: 'A.Novo',
      color: 'red'
    }
  ],

  invalid: [
    '1/1', // 1st of January disabled
    '12/25', // Christmas disabled
    {d: 'w0'}   
  ],

  onSet: function (event, inst) {
    // Your custom event handler goes here
    mobiscroll.toast({
      message: 'Aguarde...',
      color: 'success'
    });
    $('[name=date_from], [name=date_to]').each(function(index){
      $(this).val(moment($('#demo').mobiscroll('getVal')[index]).format('YYYY-MM-DD'));
    });
    setTimeout(function() {
      $('form').submit();
    }, 900);
  }

});

});

Hi Tiago, I finally managed to reproduce this issue.
Looks like it happens in specific timezones only, that’s why I could not reproduce easily.
I’m looking into it, and get back to you with more info on this!

Hi Tiago, we just released 4.4.3, which addresses this issue.
The problem was caused by the daylight saving.
We had a code like this:

while (startTime <= end) {
    // ...
    startTime.setDate(startTime.getDate() + 7);
    // ...
}

where startTime had the time set to 0:00. As the date arrived to the daylight saving day, it switches to 1:00, because in the Brazilian timezone the clock is forwarded at 0:00. Since the while cycle continued to add 7 days, all date objects after the daylight saving day had the time set to 1:00. This caused issues when determining the invalidity of the dates. In other timezones this was not an issue, since daylight saving usually occurs in the morning, 3:00 or 4:00 AM.

Feel free to upgrade to 4.4.3, and confirm if the issue is solved for you.

Best,
Isti

Thanks a lot Isti. It worked fine for me.
Best regards

Hi Isti, now I got same error on safari. I´m disabling “w0” to flag Sunday as invalid and works fine on chrome, but in Safari is disabling Saturday.
Can you check please? Thank you

Hi Tiago, thanks for reporting this.

Looks like in Safari the setDate method of the Date prototype works incorrectly with the daylight saving (at least different, than in the other browsers).
I already found a different solution, which works on Safari as well, will be included in the next release.

Ok, thanks. Do you have an estimated date to release it? I´m waiting to fix it to launch our project due it´s crucial detail at operation. Thank you.

Hi Tiago,

We released v4.5.0, which includes the fix for the iOS Safari bug.

Kind regards,
Isti