luisfarzati / ng-bs-daterangepicker

AngularJS directive for bootstrap-daterangepicker
http://luisfarzati.github.io/ng-bs-daterangepicker/
MIT License
246 stars 167 forks source link

cannot change date format #89

Open rcholic opened 8 years ago

rcholic commented 8 years ago

I found this module very handy in my project, but I have a difficult time changing the format. Below is what I tried to change the date format, but it does not work. The date still shows as '10/02/2015 - 11/04/2015' in the datepicker. I am using the latest version as of today. Thanks

<input type="daterange" id="updated_daterange" format="dd MMM yyyy" separator="/" class="form-control" placeholder="Date range for update"
                           ng-model="myDateRange"/>
cyc1ingsir commented 8 years ago

It might have to do with the fact that the format option is not a toplevel option - at least not in newer versions of the datarangepicker. This issue might help: https://github.com/dangrossman/bootstrap-daterangepicker/issues/823 This directive's line

options.format = $attributes.format || 'YYYY-MM-DD';

isn't working for me either. But this might have been changed in recent versions of the daterangepicker

maruiz93 commented 8 years ago

The format attribute does not work for me either. I select my custom format with the locale attribute.

<input type="daterange" ng-model="mainCtrl.model"  locale="mainCtrl.locale"/>
this.locale = {
        'format': 'DD MMM YYYY HH:MM',
    };
leap0ffaith commented 6 years ago

This worked for me on version 0.0.6.

<input type="daterange" ng-model="dates4" ranges="ranges" format="DD-MMM-YYYY">