Razique Mahroua
2019-11-28 1759c24ad2d2b35ec5c756e3dd3a60185fe944b7
1
2
3
4
5
6
7
8
/**
 * angular-strap
 * @version v2.0.3 - 2014-05-30
 * @link http://mgcrea.github.io/angular-strap
 * @author Olivier Louvignes (olivier@mg-crea.com)
 * @license MIT License, http://www.opensource.org/licenses/MIT
 */
"use strict";angular.module("mgcrea.ngStrap.helpers.dateParser",[]).provider("$dateParser",["$localeProvider",function(){var t=Date.prototype,e=this.defaults={format:"shortDate",strict:!1};this.$get=["$locale",function(r){var s=function(s){function n(t){var e,r=Object.keys(f),s=[],n=[],i=t;for(e=0;e<r.length;e++)if(t.split(r[e]).length>1){var a=i.search(r[e]);t=t.split(r[e]).join(""),f[r[e]]&&(s[a]=f[r[e]])}return angular.forEach(s,function(t){n.push(t)}),n}function i(t){return t.replace(/\//g,"[\\/]").replace("/-/g","[-]").replace(/\./g,"[.]").replace(/\\s/g,"[\\s]")}function a(t){var e,r=Object.keys(l),s=t;for(e=0;e<r.length;e++)s=s.split(r[e]).join("${"+e+"}");for(e=0;e<r.length;e++)s=s.split("${"+e+"}").join("("+l[r[e]]+")");return t=i(t),new RegExp("^"+s+"$",["i"])}var o,u,M=angular.extend({},e,s),c={},l={sss:"[0-9]{3}",ss:"[0-5][0-9]",s:M.strict?"[1-5]?[0-9]":"[0-9]|[0-5][0-9]",mm:"[0-5][0-9]",m:M.strict?"[1-5]?[0-9]":"[0-9]|[0-5][0-9]",HH:"[01][0-9]|2[0-3]",H:M.strict?"1?[0-9]|2[0-3]":"[01]?[0-9]|2[0-3]",hh:"[0][1-9]|[1][012]",h:M.strict?"[1-9]|1[012]":"0?[1-9]|1[012]",a:"AM|PM",EEEE:r.DATETIME_FORMATS.DAY.join("|"),EEE:r.DATETIME_FORMATS.SHORTDAY.join("|"),dd:"0[1-9]|[12][0-9]|3[01]",d:M.strict?"[1-9]|[1-2][0-9]|3[01]":"0?[1-9]|[1-2][0-9]|3[01]",MMMM:r.DATETIME_FORMATS.MONTH.join("|"),MMM:r.DATETIME_FORMATS.SHORTMONTH.join("|"),MM:"0[1-9]|1[012]",M:M.strict?"[1-9]|1[012]":"0?[1-9]|1[012]",yyyy:"[1]{1}[0-9]{3}|[2]{1}[0-9]{3}",yy:"[0-9]{2}",y:M.strict?"-?(0|[1-9][0-9]{0,3})":"-?0*[0-9]{1,4}"},f={sss:t.setMilliseconds,ss:t.setSeconds,s:t.setSeconds,mm:t.setMinutes,m:t.setMinutes,HH:t.setHours,H:t.setHours,hh:t.setHours,h:t.setHours,dd:t.setDate,d:t.setDate,a:function(t){var e=this.getHours();return this.setHours(t.match(/pm/i)?e+12:e)},MMMM:function(t){return this.setMonth(r.DATETIME_FORMATS.MONTH.indexOf(t))},MMM:function(t){return this.setMonth(r.DATETIME_FORMATS.SHORTMONTH.indexOf(t))},MM:function(t){return this.setMonth(1*t-1)},M:function(t){return this.setMonth(1*t-1)},yyyy:t.setFullYear,yy:function(t){return this.setFullYear(2e3+1*t)},y:t.setFullYear};return c.init=function(){c.$format=r.DATETIME_FORMATS[M.format]||M.format,o=a(c.$format),u=n(c.$format)},c.isValid=function(t){return angular.isDate(t)?!isNaN(t.getTime()):o.test(t)},c.parse=function(t,e,r){var s=r?a(r):o,i=r?n(r):u;if(angular.isDate(t))return t;var M=s.exec(t);if(!M)return!1;for(var c=e||new Date(0,0,1),l=0;l<M.length-1;l++)i[l]&&i[l].call(c,M[l+1]);return c},c.init(),c};return s}]}]);