bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

Datepicker: starting-day not working with localized date

Open nbkaladan opened this issue 11 years ago • 12 comments

Specifying an starting-day with a localized version of the date filter makes it not work. I've made a plunkr on it:

http://plnkr.co/edit/gKSC4cjQcWxJvamR9lli

nbkaladan avatar Jul 20 '15 10:07 nbkaladan

Can you explain a little more in detail? Do you mean that the formatting is not being applied to the input on initialization?

wesleycho avatar Jul 20 '15 13:07 wesleycho

Assuming that the initial formatting is the issue, this appears to be fixed in master - you can see it working with this Plunker.

wesleycho avatar Jul 20 '15 13:07 wesleycho

The issue is that even when I'm defining starting-day="1", the week showed up on the calendar starts on Sunday. Indeed, I tried with several values on "starting-day" (2,3,4...) and the week keeps starting on Sunday. The Plunker you have linked has the same issue.

nbkaladan avatar Jul 20 '15 13:07 nbkaladan

Ah, I understand now. This indeed is a bug with the feature.

wesleycho avatar Jul 20 '15 13:07 wesleycho

+1

jihunleekr avatar Jul 22 '15 02:07 jihunleekr

+1

fdeus avatar Sep 03 '15 10:09 fdeus

+1

nielskrijger avatar Sep 10 '15 20:09 nielskrijger

Please do not +1 an issue - it serves only as noise.

wesleycho avatar Sep 10 '15 20:09 wesleycho

So this turns out to actually be a usage issue - see this Plunker.

What happened is that the configuration should have been inside the datepicker-options attribute, which is bound to a value from your $scope.

wesleycho avatar Oct 31 '15 05:10 wesleycho

Then can you please change the doc for the datepicker? It actually says that you "can" pass the configuration using the datepicker-options attribute. It should say you "must" use that attribute.

nbkaladan avatar Nov 02 '15 11:11 nbkaladan

@nbkaladan, we've captured this in #4798.

icfantv avatar Nov 02 '15 16:11 icfantv

vm.startOptions = { minDate: new Date(), dateDisabled: disabled, startingDay: 1 }

in html

input id="field_staringDate" type="text" class="form-control" name="staringDate" required ng-change="vm.change()" datepicker-options="vm.startOptions" uib-datepicker-popup="MM/dd/yyyy" ng-model="vm.patientOrderTest.staringDate" ng-disabled="test.patientOrderItems.length > 0" is-open="vm.datePickerOpenStatus.staringDate"

maykelwong avatar May 08 '17 15:05 maykelwong