diff --git a/dist/angular-datepicker.js b/dist/angular-datepicker.js
index 94d32a5..d33736c 100644
--- a/dist/angular-datepicker.js
+++ b/dist/angular-datepicker.js
@@ -358,10 +358,12 @@
} else {
modelDate = new Date($scope.year + '/' + $scope.monthNumber + '/' + $scope.day);
}
+
+ if (attr.dateFormat) {
+ modelDate = $filter('date')(modelDate, dateFormat);
+ }
ngModelCtrl.$setViewValue(modelDate);
- thisInput.triggerHandler('input');
- thisInput.triggerHandler('change');//just to be sure;
} else {
return false;
diff --git a/dist/angular-datepicker.min.js b/dist/angular-datepicker.min.js
index 65dd5d7..1ff9d05 100644
--- a/dist/angular-datepicker.min.js
+++ b/dist/angular-datepicker.min.js
@@ -4,9 +4,9 @@
* Released by 720kb.net under the MIT license
* www.opensource.org/licenses/MIT
*
- * 2018-03-22
+ * 2018-03-26
*/
-!function(e,a){"use strict";var t=function(){if(a.userAgent&&(a.userAgent.match(/Android/i)||a.userAgent.match(/webOS/i)||a.userAgent.match(/iPhone/i)||a.userAgent.match(/iPad/i)||a.userAgent.match(/iPod/i)||a.userAgent.match(/BlackBerry/i)||a.userAgent.match(/Windows Phone/i)))return!0}(),i=function(e,a,i){return i&&(t=!1),t?['
",'"]:['"]},n=function(e,a){return['"]},r=function(e,a,t){var r=['',"
"],d=i(e,a,t),l=n(e,a),c=['"],o=['','
',"{{px}}","","
","{{item}}","",'
',"{{nx}}","","
"],s=function(e){r.splice(r.length-1,0,e)};return d.forEach(s),l.forEach(s),c.forEach(s),o.forEach(s),r.join("")};e.module("720kb.datepicker",[]).directive("datepicker",["$document","$compile","$locale","$filter","$interpolate","$timeout",function(a,i,n,d,l,c){return{require:"ngModel",restrict:"AEC",scope:{dateSet:"@",dateMinLimit:"@",dateMaxLimit:"@",dateMonthTitle:"@",dateYearTitle:"@",buttonNextTitle:"@",buttonPrevTitle:"@",dateDisabledDates:"@",dateEnabledDates:"@",dateDisabledWeekdays:"@",dateSetHidden:"@",dateTyper:"@",dateWeekStartDay:"@",datepickerAppendTo:"@",datepickerToggle:"@",datepickerClass:"@",datepickerShow:"@",clearText:"@"},link:function(o,s,m,u){var b,h,y,p=m.selector,g=e.element(p?s[0].querySelector("."+p):s[0].children[0]),k=m.buttonPrev||'',M=m.buttonNext||'',f=m.dateFormat,D=o.$eval(o.dateDisabledDates),v=o.$eval(o.dateEnabledDates),N=o.$eval(o.dateDisabledWeekdays),w=new Date,S=!1,x=!1,Y=void 0!==m.datepickerMobile&&"false"!==m.datepickerMobile,T=n.DATETIME_FORMATS,_=r(k,M,Y),L=function(){S||x||!b||o.hideCalendar()},$=function(e,a){var t,i,n,r,d,l=new Date(a,e,0).getDate(),c=new Date(a+"/"+e+"/1").getDay(),s=new Date(a+"/"+e+"/"+l).getDay(),m=[],u=[];for(o.days=[],o.dateWeekStartDay=o.validateWeekDay(o.dateWeekStartDay),d=(o.dateWeekStartDay+6)%7,t=1;t<=l;t+=1)o.days.push(t);if(c===o.dateWeekStartDay)o.prevMonthDays=[];else{for(n=c-o.dateWeekStartDay,c0}),t=a.match(m).filter(function(e){return null!==e.match(/^[a-zA-Z]+$/i)}),l=0;l-1||((t=e.className.split(" ")).push(a),e.className=t.join(" "))},remove:function(e,a){var t,i;if(-1!==e.className.indexOf(a)){for(i=e.className.split(" "),t=0;tNumber(e)&&!o.isSelectableMinYear(e))return;o.paginateYears(e),o.showYearsPagination=!1,c(function(){o.year=Number(e),$(o.monthNumber,o.year)},0)},o.hideCalendar=function(){b.classList?b.classList.remove("_720kb-datepicker-open"):O.remove(b,"_720kb-datepicker-open")},o.setDatepickerDay=function(e){o.isSelectableDay(o.monthNumber,o.year,e)&&o.isSelectableDate(o.monthNumber,o.year,e)&&o.isSelectableMaxDate(o.year+"/"+o.monthNumber+"/"+e)&&o.isSelectableMinDate(o.year+"/"+o.monthNumber+"/"+e)&&(o.day=Number(e),o.selectedDay=o.day,o.selectedMonth=o.monthNumber,o.selectedYear=o.year,E(),m.hasOwnProperty("dateRefocus")&&g[0].focus(),o.hideCalendar())},o.paginateYears=function(e){var a,i=[],n=10,r=10;for(o.paginationYears=[],t&&(n=50,r=50,o.dateMinLimit&&o.dateMaxLimit&&(n=(e=new Date(o.dateMaxLimit).getFullYear())-new Date(o.dateMinLimit).getFullYear(),r=1)),a=n;a>0;a-=1)i.push(Number(e)-a);for(a=0;a0)try{(w=f?W(u.$viewValue.toString(),f):new Date(u.$viewValue.toString())).getFullYear()&&!isNaN(w.getDay())&&!isNaN(w.getMonth())&&o.isSelectableDay(w.getMonth(),w.getFullYear(),w.getDay())&&o.isSelectableDate(w.getMonth(),w.getFullYear(),w.getDay())&&o.isSelectableMaxDate(w)&&o.isSelectableMinDate(w)&&o.$apply(function(){o.month=d("date")(w,"MMMM"),o.monthNumber=Number(d("date")(w,"MM")),o.day=Number(d("date")(w,"dd")),4===w.getFullYear().toString().length&&(o.year=Number(d("date")(w,"yyyy"))),$(o.monthNumber,o.year)})}catch(e){return e}}),o.dateMaxLimit&&i&&i.length&&!o.isSelectableMaxYear(Number(i[i.length-1])+1)?o.paginationYearsNextDisabled=!0:o.paginationYearsNextDisabled=!1,o.dateMinLimit&&i&&i.length&&!o.isSelectableMinYear(Number(i[0])-1)?o.paginationYearsPrevDisabled=!0:o.paginationYearsPrevDisabled=!1,o.paginationYears=i},o.isSelectableDay=function(e,a,t){var i=0;if(N&&N.length>0)for(i;i<=N.length;i+=1)if(N[i]===new Date(e+"/"+t+"/"+a).getDay())return!1;return!0},o.isSelectableDate=function(e,a,t){var i=0;if(D&&D.length>0)for(i;i<=D.length;i+=1)if(new Date(D[i]).getTime()===new Date(e+"/"+t+"/"+a).getTime())return!1;if(v){for(i;i<=v.length;i+=1)if(new Date(v[i]).getTime()===new Date(e+"/"+t+"/"+a).getTime())return!0;return!1}return!0},o.isSelectableMinDate=function(e){return!(o.dateMinLimit&&new Date(o.dateMinLimit)&&new Date(e).getTime()new Date(o.dateMaxLimit).getTime())},o.isSelectableMaxYear=function(e){return!(o.dateMaxLimit&&e>new Date(o.dateMaxLimit).getFullYear())},o.isSelectableMinYear=function(e){return!(o.dateMinLimit&&e6)&&(a=0),a},o.clear=function(){u.$setViewValue(null),g.triggerHandler("input"),g.triggerHandler("change"),o.hideCalendar()},_=_.replace(/{{/g,l.startSymbol()).replace(/}}/g,l.endSymbol()),o.dateMonthTitle=o.dateMonthTitle||"Select month",o.dateYearTitle=o.dateYearTitle||"Select year",o.buttonNextTitle=o.buttonNextTitle||"Next",o.buttonPrevTitle=o.buttonPrevTitle||"Prev",o.month=d("date")(w,"MMMM"),o.monthNumber=Number(d("date")(w,"MM")),o.day=Number(d("date")(w,"dd")),o.dateWeekStartDay=o.validateWeekDay(o.dateWeekStartDay),o.dateMaxLimit?o.year=Number(d("date")(new Date(o.dateMaxLimit),"yyyy")):o.year=Number(d("date")(w,"yyyy")),o.months=T.MONTH,o.daysInString=[],y=o.dateWeekStartDay;y<=o.dateWeekStartDay+6;y+=1)o.daysInString.push(y%7);o.daysInString=o.daysInString.map(function(e){return d("date")(new Date(new Date("06/08/2014").valueOf()+864e5*e),"EEE")}),o.datepickerAppendTo&&-1!==o.datepickerAppendTo.indexOf(".")?(o.datepickerID="datepicker-id-"+(new Date).getTime()+(Math.floor(6*Math.random())+8),e.element(document.getElementsByClassName(o.datepickerAppendTo.replace(".",""))[0]).append(i(e.element(_))(o,function(a){b=e.element(a)[0]}))):o.datepickerAppendTo&&-1!==o.datepickerAppendTo.indexOf("#")?(o.datepickerID="datepicker-id-"+(new Date).getTime()+(Math.floor(6*Math.random())+8),e.element(document.getElementById(o.datepickerAppendTo.replace("#",""))).append(i(e.element(_))(o,function(a){b=e.element(a)[0]}))):o.datepickerAppendTo&&"body"===o.datepickerAppendTo?(o.datepickerID="datepicker-id-"+((new Date).getTime()+(Math.floor(6*Math.random())+8)),e.element(document).find("body").append(i(e.element(_))(o,function(a){b=e.element(a)[0]}))):(g.after(i(e.element(_))(o)),b=s[0].querySelector("._720kb-datepicker-calendar")),o.datepickerToggle&&!o.$eval(o.datepickerToggle)||g.on("focus click focusin",function(e){"INPUT"===e.target.nodeName&&(x=!0,S||x||!b?F():o.hideCalendar())}),g.on("focusout blur",function(){x=!1,S||x||!b||o.hideCalendar()}),e.element(b).on("mouseenter",function(){S=!0}),e.element(b).on("mouseleave",function(){S=!1}),e.element(b).on("focusin",function(){S=!0}),a.on("click focus focusin",L),(o.dateMinLimit&&!o.isSelectableMinYear(o.year)||!o.isSelectableMinDate(o.year+"/"+o.monthNumber+"/"+o.day))&&A(),(o.dateMaxLimit&&!o.isSelectableMaxYear(o.year)||!o.isSelectableMaxDate(o.year+"/"+o.monthNumber+"/"+o.day))&&P(),o.paginateYears(o.year),$(o.monthNumber,o.year),o.checkVisibility=function(){return!!o.datepickerShow&&(w=f?W(u.$viewValue.toString(),f):new Date(u.$viewValue.toString()),o.selectedMonth=Number(d("date")(w,"MM")),o.selectedDay=Number(d("date")(w,"dd")),o.selectedYear=Number(d("date")(w,"yyyy")),o.$eval(o.datepickerShow))},o.$on("$destroy",function(){j(),C(),I(),B(),G(),q(),g.off("focus click focusout blur"),e.element(b).off("mouseenter mouseleave focusin"),a.off("click focus focusin",L)})}}}])}(angular,navigator);
+!function(C,e){"use strict";var I=function(){if(e.userAgent&&(e.userAgent.match(/Android/i)||e.userAgent.match(/webOS/i)||e.userAgent.match(/iPhone/i)||e.userAgent.match(/iPad/i)||e.userAgent.match(/iPod/i)||e.userAgent.match(/BlackBerry/i)||e.userAgent.match(/Windows Phone/i)))return!0}(),B=function(e,a,t){var i,n,r=['',"
"],d=(i=e,n=a,t&&(I=!1),I?['",'"]:['"]),l=['"],c=['"],o=['','
',"{{px}}","","
","{{item}}","",'
',"{{nx}}","","
"],s=function(e){r.splice(r.length-1,0,e)};return d.forEach(s),l.forEach(s),c.forEach(s),o.forEach(s),r.join("")};C.module("720kb.datepicker",[]).directive("datepicker",["$document","$compile","$locale","$filter","$interpolate","$timeout",function(W,E,H,O,F,j){return{require:"ngModel",restrict:"AEC",scope:{dateSet:"@",dateMinLimit:"@",dateMaxLimit:"@",dateMonthTitle:"@",dateYearTitle:"@",buttonNextTitle:"@",buttonPrevTitle:"@",dateDisabledDates:"@",dateEnabledDates:"@",dateDisabledWeekdays:"@",dateSetHidden:"@",dateTyper:"@",dateWeekStartDay:"@",datepickerAppendTo:"@",datepickerToggle:"@",datepickerClass:"@",datepickerShow:"@",clearText:"@"},link:function(u,e,a,r){var t,i,n,d=a.selector,l=C.element(d?e[0].querySelector("."+d):e[0].children[0]),c=a.buttonPrev||'',o=a.buttonNext||'',s=a.dateFormat,m=u.$eval(u.dateDisabledDates),b=u.$eval(u.dateEnabledDates),h=u.$eval(u.dateDisabledWeekdays),y=new Date,p=!1,g=!1,k=void 0!==a.datepickerMobile&&"false"!==a.datepickerMobile,M=H.DATETIME_FORMATS,f=B(c,o,k),D=function(){p||g||!t||u.hideCalendar()},N=function(e,a){var t,i,n,r,d,l=new Date(a,e,0).getDate(),c=new Date(a+"/"+e+"/1").getDay(),o=new Date(a+"/"+e+"/"+l).getDay(),s=[],m=[];for(u.days=[],u.dateWeekStartDay=u.validateWeekDay(u.dateWeekStartDay),d=(u.dateWeekStartDay+6)%7,t=1;t<=l;t+=1)u.days.push(t);if(c===u.dateWeekStartDay)u.prevMonthDays=[];else{for(n=c-u.dateWeekStartDay,cNumber(e)&&!u.isSelectableMinYear(e))return;u.paginateYears(e),u.showYearsPagination=!1,j(function(){u.year=Number(e),N(u.monthNumber,u.year)},0)},u.hideCalendar=function(){t.classList?t.classList.remove("_720kb-datepicker-open"):T(t,"_720kb-datepicker-open")},u.setDatepickerDay=function(e){u.isSelectableDay(u.monthNumber,u.year,e)&&u.isSelectableDate(u.monthNumber,u.year,e)&&u.isSelectableMaxDate(u.year+"/"+u.monthNumber+"/"+e)&&u.isSelectableMinDate(u.year+"/"+u.monthNumber+"/"+e)&&(u.day=Number(e),u.selectedDay=u.day,u.selectedMonth=u.monthNumber,u.selectedYear=u.year,x(),a.hasOwnProperty("dateRefocus")&&l[0].focus(),u.hideCalendar())},u.paginateYears=function(e){var a,t=[],i=10,n=10;for(u.paginationYears=[],I&&(n=i=50,u.dateMinLimit&&u.dateMaxLimit&&(i=(e=new Date(u.dateMaxLimit).getFullYear())-new Date(u.dateMinLimit).getFullYear(),n=1)),a=i;0new Date(u.dateMaxLimit).getTime())},u.isSelectableMaxYear=function(e){return!(u.dateMaxLimit&&e>new Date(u.dateMaxLimit).getFullYear())},u.isSelectableMinYear=function(e){return!(u.dateMinLimit&&e