Problem with conversion of specific dates on iOS

Hi,

I recently found an awkward issue with date conversions. Have a look:
{{ ‘2015-02-21’ | date:‘MMM d, y’ }} prints ‘Feb 21, 2015’ - perfect!
{{ ‘2015-02-22’ | date:‘MMM d, y’ }} prints ‘Feb 21, 2015’ - fail!

It’s also happening with other dates:
{{ ‘2016-02-21’ | date:‘MMM d, y’ }} prints ‘Feb 20, 2016’ - fail!
{{ ‘2017-02-19’ | date:‘MMM d, y’ }} prints ‘Feb 18, 2017’ - fail!

It does not happen on my browser neither on Android, just on iOS (I’ve tested on iPhone 4, 5 and iPad 2), and it occurs just with specific dates.

What could be wrong?

Thanks,

ios dates are different, you should split your current date and rebuild it like this

var t = date.split(/[- :]/);
// Apply each element to the Date function
var d = new Date(t[0], t[1]-1, t[2], t[3], t[4], t[5]);