/** * angular-strap * @version v2.3.5 - 2015-10-29 * @link http://mgcrea.github.io/angular-strap * @author Olivier Louvignes (https://github.com/mgcrea) * @license MIT License, http://www.opensource.org/licenses/MIT */ 'use strict';angular.module('mgcrea.ngStrap.helpers.dateParser',[]).provider('$dateParser',['$localeProvider',function(t){function e(){this.year=1970,this.month=0,this.day=1,this.hours=0,this.minutes=0,this.seconds=0,this.milliseconds=0}function n(){}function s(t){return!isNaN(parseFloat(t))&&isFinite(t)}function r(t,e){for(var n=t.length,s=e.toString().toLowerCase(),r=0;n>r;r++)if(t[r].toLowerCase()===s)return r;return-1}e.prototype.setMilliseconds=function(t){this.milliseconds=t},e.prototype.setSeconds=function(t){this.seconds=t},e.prototype.setMinutes=function(t){this.minutes=t},e.prototype.setHours=function(t){this.hours=t},e.prototype.getHours=function(){return this.hours},e.prototype.setDate=function(t){this.day=t},e.prototype.setMonth=function(t){this.month=t},e.prototype.setFullYear=function(t){this.year=t},e.prototype.fromDate=function(t){return this.year=t.getFullYear(),this.month=t.getMonth(),this.day=t.getDate(),this.hours=t.getHours(),this.minutes=t.getMinutes(),this.seconds=t.getSeconds(),this.milliseconds=t.getMilliseconds(),this},e.prototype.toDate=function(){return new Date(this.year,this.month,this.day,this.hours,this.minutes,this.seconds,this.milliseconds)};var i=e.prototype,o=this.defaults={format:'shortDate',strict:!1};this.$get=['$locale','dateFilter',function(t,a){var u=function(u){function h(t){var e,n=Object.keys(D),s=[],r=[],i=t;for(e=0;e1){var o=i.search(n[e]);t=t.split(n[e]).join(''),D[n[e]]&&(s[o]=D[n[e]])}return angular.forEach(s,function(t){t&&r.push(t)}),r}function l(t){return t.replace(/\//g,'[\\/]').replace('/-/g','[-]').replace(/\./g,'[.]').replace(/\\s/g,'[\\s]')}function c(t){var e,n=Object.keys(p),s=t;for(e=0;e=1*t&&2===t.length?this.setFullYear(2e3+1*t):this.setFullYear(1*t)}};return m.init=function(){m.$format=t.DATETIME_FORMATS[g.format]||g.format,f=c(m.$format),M=h(m.$format)},m.isValid=function(t){return angular.isDate(t)?!isNaN(t.getTime()):f.test(t)},m.parse=function(n,s,r,i){r&&(r=t.DATETIME_FORMATS[r]||r),angular.isDate(n)&&(n=a(n,r||m.$format,i));var o=r?c(r):f,u=r?h(r):M,l=o.exec(n);if(!l)return!1;for(var g=s&&!isNaN(s.getTime())?(new e).fromDate(s):(new e).fromDate(new Date(1970,0,1,0)),p=0;p12?t.getHours()+2:0),t):null},m.timezoneOffsetAdjust=function(t,e,n){return t?(e&&'UTC'===e&&(t=new Date(t.getTime()),t.setMinutes(t.getMinutes()+(n?-1:1)*t.getTimezoneOffset())),t):null},m.init(),m};return u}]}]); //# sourceMappingURL=date-parser.min.js.map