bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

Passing string value as ng-model breaks datepicker (ui.bootstrap 1.1.2)

Open asakalou opened this issue 10 years ago • 1 comments

If string value is passed to ng-model opening datepicker causes js error and datepicker doesn't work (it even doesn't render it's value in input). If Date is passed everything is ok.

$scope.format = 'MM-dd-yyyy';

$scope.startDate = '10-11-2015'; // TypeError: this.activeDate.getFullYear is not a function
$scope.endDate = new Date(); // ok

Please see plunk: http://plnkr.co/edit/xrsxVlyrY54CnDkx4i4u?p=preview From server side I receive date string in format MM-dd-yyyy. Could you please advise how to fix this issue. Manually transforming string from server to Date doesn't look handy.

Thanks!

asakalou avatar Feb 06 '16 18:02 asakalou

The date picker requires a JavaScript date object. Please extend is the courtesy of searching both open and closed issues as well as reading the project documentation.

icfantv avatar Feb 06 '16 20:02 icfantv