UNPKG

ng-jalali-date-time

Version:

Jalali date / month / range picker for Angular with Material Design support

16 lines (14 loc) 50.2 kB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/common"),require("@angular/forms"),require("jalali-date-time"),require("@angular/material/button"),require("@angular/material/divider"),require("@angular/material/input"),require("@angular/animations")):"function"==typeof define&&define.amd?define("ng-jalali-date-time",["exports","@angular/core","@angular/common","@angular/forms","jalali-date-time","@angular/material/button","@angular/material/divider","@angular/material/input","@angular/animations"],e):e((t=t||self)["ng-jalali-date-time"]={},t.ng.core,t.ng.common,t.ng.forms,t["jalali-date-time"],t.ng.material.button,t.ng.material.divider,t.ng.material.input,t.ng.animations)}(this,(function(t,e,n,a,i,o,r,s,l){"use strict"; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */Object.create;function c(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var a,i,o=n.call(t),r=[];try{for(;(void 0===e||e-- >0)&&!(a=o.next()).done;)r.push(a.value)}catch(t){i={error:t}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return r}Object.create;var h=function(){this.required="مشخص کردن مقدار الزامی است",this.notSpecified="مشخص نشده است",this.date="تاریخ",this.month="ماه",this.range="دوره زمانی",this.rangeTo="تا",this.rangeCustom="سفارشی",this.rangeCustomConfirm="انتخاب",this.rangeCurrentWeek="هفته جاری",this.rangeCurrentMonth="ماه جاری",this.rangeLast7Days="۷ روز گذشته",this.rangeLast30Days="۳۰ روز گذشته",this.rangeNext7Days="۷ روز آینده",this.rangeNext30Days="۳۰ روز آینده",this.monthNames=["فروردین","اردیبهشت","خرداد","تیر","مرداد","شهریور","مهر","آبان","آذر","دی","بهمن","اسفند"],this.dayNames=["ش","ی","د","س","چ","پ","ج"]},m=function(){function t(){this.jalali=i.JalaliDateTime({timezone:"Asia/Tehran",locale:"en",dateFormat:"Y-M-D",timeFormat:"H:I:S",titleFormat:"W، d N Y",fullTextFormat:"W، d N Y H:I:S"}),this.jalaliLocale=new h}return t.prototype.checkDate=function(t){if("string"!=typeof t||10!==t.length)return"";if(!t.match(/([0-9]{4}-[0-9]{2}-[0-9]{2})/))return"";var e=c(t.split("-"),3),n=e[0],a=e[1],i=e[2];return Number(n)<1e3||Number(n)>4e3||Number(a)<1||Number(a)>12||Number(i)<1||Number(i)>31?"":t},t.prototype.checkTime=function(t){if("string"!=typeof t||8!==t.length)return"";if(!t.match(/([0-9]{2}:[0-9]{2}:[0-9]{2})/))return"";var e=c(t.split("-"),3),n=e[0],a=e[1],i=e[2];return Number(n)<0||Number(n)>23||Number(a)<0||Number(a)>59||Number(i)<0||Number(i)>59?"":t},t.prototype.checkMonth=function(t){if("string"!=typeof t||7!==t.length)return"";if(!t.match(/([0-9]{4}-[0-9]{2})/))return"";var e=c(t.split("-"),2),n=e[0],a=e[1];return Number(n)<1e3||Number(n)>4e3||Number(a)<1||Number(a)>12?"":t},t.prototype.checkAppearance=function(t){return["legacy","standard","fill","outline"].includes(t)?t:"legacy"},t.prototype.setFontCSS=function(t,e){return Object.assign(Object.assign({},t),{fontFamily:e})},t.prototype.checkCSS=function(t){return t||(t={}),t.font=t.font?t.font:"Roboto, 'Helvetica Neue', sans-serif",t.field=t.field?t.field:{},t.input=this.setFontCSS(t.input?t.input:{},t.font),t.reset=t.reset?t.reset:{},t.box=t.box?t.box:{},t.arrow=t.arrow?t.arrow:{},t.header=this.setFontCSS(t.header?t.header:{},t.font),t.item=this.setFontCSS(t.item?t.item:{},t.font),t.selected=t.selected?t.selected:{},t.selected=Object.assign(Object.assign({},t.item),t.selected),t.current=t.current?t.current:{},t.current=Object.assign(Object.assign({},t.item),t.current),t.date||(t.date={}),t.date.name=this.setFontCSS(t.date.name?t.date.name:{},t.font),t.date.time=this.setFontCSS(t.date.time?t.date.time:{},t.font),t.month||(t.month={}),t.range||(t.range={}),t.range.tool=this.setFontCSS(t.range.tool?t.range.tool:{},t.font),t.range.custom=t.range.custom?t.range.custom:{},t.range.custom=Object.assign(Object.assign({},t.range.tool),t.range.custom),t.range.confirm=t.range.confirm?t.range.confirm:{},t.range.confirm=Object.assign(Object.assign(Object.assign({},t.range.tool),t.range.custom),t.range.confirm),t.range.name=this.setFontCSS(t.range.name?t.range.name:{},t.font),t.range.date=this.setFontCSS(t.range.date?t.range.date:{},t.font),t},t.prototype.jalaliToGregorian=function(t,e){var n=this.jalali.gregorian(t).date;return new Date(n+"T"+(this.checkTime(e)?e:"12:00:00"))},t.prototype.getCalendar=function(t){for(var e=this.jalaliToGregorian(t+"-01"),n=this.jalali.toFullText(e,{format:"N Y"}),a=e;6!==a.getDay();)a=new Date(a.getTime()-864e5);for(var i=[],o=[],r=this.jalali.toDate(a);r.substr(0,7)<=t||o.length%7!=0;)o.push({date:r,month:r.substr(0,7),day:Number(r.substr(8))}),7===o.length&&(i.push({days:o}),o=[]),a=new Date(a.getTime()+864e5),r=this.jalali.toDate(a);return{month:t,title:n,weeks:i}},t.prototype.getDayInMonth=function(t){var e=c(t.split("-"),2),n=(e[0],e[1]);if(Number(n)<7)return 31;if(Number(n)<12)return 30;var a=this.jalaliToGregorian(t+"-30");return this.jalali.toString(a,{format:"Y-M-D"}).substr(0,7)===t?30:29},t.prototype.getDateTimeValue=function(t,e){var n=t?this.jalali.gregorian(t).date:"",a=n?new Date(n+"T"+(e||"12:00:00")):null,i=n?Math.floor(a.getTime()/1e3):null;return{jalali:t,gregorian:n,date:a,time:e=e||"00:00:00",timestamp:i}},t.prototype.getDateTimeTitle=function(t,e){return t.jalali?e?this.jalali.toFullText(t.date):this.jalali.toTitle(t.date):""},t.prototype.getMonthValue=function(t){var e=0,n={first:"",last:""};return t&&(e=this.getDayInMonth(t),n.first=this.jalali.gregorian(t+"-01").date,n.last=this.jalali.gregorian(t+"-"+e.toString()).date),{month:t,days:e,gregorian:n}},t.prototype.getMonthTitle=function(t){if(!t.month)return"";var e=this.jalaliToGregorian(t.month+"-01");return this.jalali.toTitle(e,{format:"N Y"})},t.prototype.getRangeValue=function(t,e){var n=0,a=0,i=0,o=0,r={from:"",to:""};if(t&&e){r.from=this.jalali.gregorian(t).date,r.to=this.jalali.gregorian(e).date;var s=Math.floor(new Date(r.from+"T12:00:00").getTime()/1e3),l=Math.floor(new Date(r.to+"T12:00:00").getTime()/1e3);o=60*(i=60*(a=24*(n=Math.floor(Math.abs((l-s)/86400))+1)))}return{range:t&&e?t+"|"+e:"",from:t,to:e,days:n,hours:a,minutes:i,seconds:o,gregorian:r}},t.prototype.getRangeTitle=function(t){if(!t.from||!t.to)return"";var e=this.jalaliToGregorian(t.from),n=this.jalaliToGregorian(t.to),a=c(t.from.split("-"),3),i=a[0],o=a[1],r=(a[2],c(t.to.split("-"),3)),s=r[0],l=r[1];r[2];return(i===s&&o===l?this.jalali.toTitle(e,{format:"d"}):i===s?this.jalali.toTitle(e,{format:"d N"}):this.jalali.toTitle(e,{format:"d N Y"}))+" "+this.jalaliLocale.rangeTo+" "+this.jalali.toTitle(n,{format:"d N Y"})},t}();m.decorators=[{type:e.Injectable}],m.ctorParameters=function(){return[]};var d=function(){};d.decorators=[{type:e.NgModule,args:[{exports:[s.MatInputModule,o.MatButtonModule,r.MatDividerModule]}]}];var g=function(){function t(t){this.service=t,this.show=!1,this.random=Date.now().toString(),this.month="",this.today="",this.reset=!1,this.jalaliLocale=new h,this.week=this.jalaliLocale.dayNames,this.changed=new e.EventEmitter}return t.prototype.ngOnInit=function(){this.month=this.value.jalali?this.value.jalali.substr(0,7):this.service.jalali.now({format:"Y-M"}),this.calendar=this.service.getCalendar(this.month),this.today=this.service.jalali.now({format:"Y-M-D"});var t=[];this.config.required&&t.push(this.validate.bind(this)),this.form.addControl(this.name,new a.FormControl(this.value)),this.form.addControl(this.name+"-title",new a.FormControl("",t)),this.setTitle()},t.prototype.validate=function(){return this.value.jalali?null:{required:!0}},t.prototype.showCalendar=function(t){document.querySelector("#input"+this.random).blur(),this.reset&&(this.reset=!1,t=!1),this.show=t,this.show?(this.form.get(this.name+"-title").markAsUntouched(),this.value.jalali||(this.value.time="00:00:00"),this.month=this.value.jalali?this.value.jalali.substr(0,7):this.service.jalali.now({format:"Y-M"}),this.calendar=this.service.getCalendar(this.month)):this.form.get(this.name+"-title").markAsTouched()},t.prototype.changeMonth=function(t){for(var e=c(this.month.split("-"),2),n=e[0],a=e[1],i=Number(n),o=Number(a)+t;o>12;)o-=12,i++;for(;o<1;)o+=12,i--;this.month=i.toString()+"-"+(o<10?"0":"")+o.toString(),this.calendar=this.service.getCalendar(this.month)},t.prototype.setTitle=function(){this.form.get(this.name).setValue(this.value);var t=this.service.getDateTimeTitle(this.value,this.config.time);this.form.get(this.name+"-title").setValue(t)},t.prototype.setDate=function(t){this.value=this.service.getDateTimeValue(t,this.value.time),this.setTitle(),this.showCalendar(!1),this.changed.emit(this.value.jalali?this.value:null),this.form.get(this.name+"-title").updateValueAndValidity()},t.prototype.getTime=function(t){if(!this.value.time)return 0;var e=0;switch(t){case"H":e=Number(this.value.time.substr(0,2));break;case"I":e=Number(this.value.time.substr(3,2));break;case"S":e=Number(this.value.time.substr(6,2))}return isNaN(e)?0:e},t.prototype.setTime=function(){var t=document.querySelector("#hour"+this.random),e=document.querySelector("#minute"+this.random),n=document.querySelector("#second"+this.random),a=Math.floor(Number(t.value));a=isNaN(a)||a<0||a>23?0:a,t.value=a.toString();var i=Math.floor(Number(e.value));i=isNaN(i)||i<0||i>59?0:i,e.value=i.toString();var o=Math.floor(Number(n.value));o=isNaN(o)||o<0||o>59?0:o,n.value=this.config.second?o.toString():"00";var r=(a<10?"0":"")+a.toString()+":"+(i<10?"0":"")+i.toString()+":"+(o<10?"0":"")+o.toString();this.value=this.service.getDateTimeValue(this.value.jalali,r),this.setTitle(),this.changed.emit(this.value.jalali?this.value:null),this.form.get(this.name+"-title").updateValueAndValidity()},t}();g.decorators=[{type:e.Component,args:[{template:'<div class="ng-jalali-back" *ngIf="show" (click)="showCalendar(false)"></div>\n\n<div [formGroup]="form" [ngStyle]="{ display: \'none\' }">\n <input type="text" [formControlName]="name" />\n</div>\n\n<content class="ng-jalali" dir="rtl">\n <mat-form-field [ngStyle]="css.field" class="ng-jalali" [formGroup]="form" [appearance]="appearance">\n <mat-label [ngStyle]="{ fontFamily: css.font }">{{ label }}</mat-label>\n <input\n matInput\n id="input{{ random }}"\n type="text"\n [formControlName]="name + \'-title\'"\n (focus)="showCalendar(true)"\n [ngStyle]="css.input"\n class="ng-jalali"\n />\n <span *ngIf="config.reset && value.jalali !== \'\'" matSuffix (click)="setDate(\'\'); reset = true">\n <button mat-button type="button" [ngStyle]="css.reset" class="ng-jalali-reset">x</button>\n </span>\n <mat-error [ngStyle]="{ fontFamily: css.font }" *ngIf="form.get(name + \'-title\').hasError(\'required\')">\n {{ config.error }}\n </mat-error>\n </mat-form-field>\n\n <div class="ng-jalali-calendar" [ngStyle]="css.box" [@calendar] *ngIf="show">\n <div class="ng-jalali-header">\n <div>\n <button\n mat-icon-button\n type="button"\n [ngStyle]="css.arrow"\n (click)="changeMonth(-12)"\n [disabled]="month.substr(0, 4) === \'1000\'"\n >\n &lt;&lt;\n </button>\n </div>\n <div>\n <button\n mat-icon-button\n type="button"\n [ngStyle]="css.arrow"\n (click)="changeMonth(-1)"\n [disabled]="month === \'1000-01\'"\n >\n &lt;\n </button>\n </div>\n <div class="ng-jalali-title" [ngStyle]="css.header">{{ calendar.title }}</div>\n <div>\n <button mat-icon-button type="button" [ngStyle]="css.arrow" (click)="changeMonth(1)">&gt;</button>\n </div>\n <div>\n <button mat-icon-button type="button" [ngStyle]="css.arrow" (click)="changeMonth(12)">&gt;&gt;</button>\n </div>\n </div>\n <div class="ng-jalali-date-time-header">\n <div [ngStyle]="css.date.name" *ngFor="let day of week">{{ day }}</div>\n </div>\n <div *ngFor="let week of calendar.weeks" class="ng-jalali-date-time-week">\n <div *ngFor="let day of week.days" class="ng-jalali-date-time-day">\n <button\n mat-icon-button\n type="button"\n [disabled]="\n day.month !== month ||\n (config.min && day.date < config.min) ||\n (config.max && day.date > config.max)\n "\n [ngClass]="{\n \'ng-jalali-selected\': day.date === value.jalali,\n \'ng-jalali-current\': day.date === today\n }"\n [ngStyle]="day.date === today ? css.current : day.date === value.jalali ? css.selected : css.item"\n (click)="setDate(day.date)"\n >\n {{ day.day }}\n </button>\n </div>\n </div>\n <ng-container *ngIf="config.time">\n <mat-divider></mat-divider>\n <div class="ng-jalali-date-time-time">\n <input\n type="number"\n min="0"\n max="23"\n step="1"\n [value]="getTime(\'H\')"\n [ngStyle]="css.date.time"\n id="hour{{ random }}"\n (blur)="setTime()"\n />\n <div>:</div>\n <input\n type="number"\n min="0"\n max="59"\n step="1"\n [value]="getTime(\'I\')"\n [ngStyle]="css.date.time"\n id="minute{{ random }}"\n (blur)="setTime()"\n />\n <div>:</div>\n <input\n type="number"\n min="0"\n max="59"\n step="1"\n [disabled]="!config.second"\n [value]="config.second ? getTime(\'S\') : \'00\'"\n [ngStyle]="css.date.time"\n id="second{{ random }}"\n (blur)="setTime()"\n /></div\n ></ng-container>\n </div>\n</content>\n',animations:[l.trigger("calendar",[l.state("init",l.style({opacity:1,transform:"translateY(0) scaleY(1)"})),l.transition("void => *",[l.style({opacity:0,transform:"translateY(-45%) scaleY(0)"}),l.animate(100)]),l.transition("* => void",l.animate(100,l.style({opacity:0,transform:"translateY(-45%) scaleY(0)"})))])],styles:["div.ng-jalali-date-time-header{display:flex}div.ng-jalali-date-time-header div{background-color:#ddd;flex:1;padding:1rem .2rem;text-align:center}div.ng-jalali-date-time-week{display:flex}div.ng-jalali-date-time-day{flex:1;padding:.2rem;text-align:center}div.ng-jalali-date-time-time{align-items:center;direction:ltr;display:flex;margin:.5rem}div.ng-jalali-date-time-time div{text-align:center;width:2rem}div.ng-jalali-date-time-time input{background-color:#eee;border:0;direction:rtl;flex:1;outline:none;padding:.5rem;text-align:center}","div.ng-jalali-back{background-color:transparent;bottom:0;left:0;position:fixed;right:0;top:0;z-index:999}content.ng-jalali{display:block;position:relative}mat-form-field.ng-jalali{direction:rtl;margin:0;text-align:right;width:100%}input.ng-jalali{cursor:default;text-align:right}button.ng-jalali-reset{color:#555;line-height:30px;min-width:auto;padding:0 .5rem}div.ng-jalali-calendar{background-color:#fff;box-shadow:0 2px 4px -1px rgba(0,0,0,.2),0 4px 5px 0 rgba(0,0,0,.14),0 1px 10px 0 rgba(0,0,0,.12);direction:rtl;position:absolute;right:0;top:45px;z-index:1000}div.ng-jalali-header{align-items:center;display:flex}div.ng-jalali-header div{flex:1;padding:.5rem .2rem;text-align:center}div.ng-jalali-header div.ng-jalali-title{flex:3}button.ng-jalali-selected{background-color:#eee;border:1px solid #999}button.ng-jalali-current{color:#009}"]}]}],g.ctorParameters=function(){return[{type:m}]},g.propDecorators={changed:[{type:e.Output}]};var u=function(){function t(t,n,a){this.resolver=t,this.container=n,this.service=a,this.jalaliLocale=new h,this.changed=new e.EventEmitter}return t.prototype.ngOnInit=function(){this.form||(this.form=new a.FormGroup({})),this.name||(this.name="jalali-date-time-"+Date.now().toString()),this.appearance=this.service.checkAppearance(this.appearance),this.config||(this.config={}),this.config.required=!!this.config.required,this.config.min=this.service.checkDate(this.config.min)?this.config.min:null,this.config.max=this.service.checkDate(this.config.max)?this.config.max:null,this.config.reset=!1!==this.config.reset,this.config.error=this.config.error?this.config.error:this.jalaliLocale.required,this.config.time=!!this.config.time,this.config.second=!!this.config.second,this.css=this.service.checkCSS(this.css),this.date=this.service.checkDate(this.date),this.time=this.config.time?this.service.checkTime(this.time):"",this.label=this.label?this.label:this.jalaliLocale.date;var t=this.resolver.resolveComponentFactory(g);this.component=this.container.createComponent(t),this.component.instance.form=this.form,this.component.instance.name=this.name,this.component.instance.appearance=this.appearance,this.component.instance.config=this.config,this.component.instance.css=this.css,this.component.instance.value=this.service.getDateTimeValue(this.date,this.time),this.component.instance.label=this.label,this.component.instance.changed=this.changed},t}();u.decorators=[{type:e.Directive,args:[{selector:"[jalali-date-time]"}]}],u.ctorParameters=function(){return[{type:e.ComponentFactoryResolver},{type:e.ViewContainerRef},{type:m}]},u.propDecorators={form:[{type:e.Input}],name:[{type:e.Input}],appearance:[{type:e.Input}],config:[{type:e.Input}],css:[{type:e.Input}],date:[{type:e.Input}],time:[{type:e.Input}],label:[{type:e.Input}],changed:[{type:e.Output}]};var f=function(){function t(t){this.service=t,this.show=!1,this.random=Date.now().toString(),this.month="",this.year="",this.current="",this.reset=!1,this.jalaliLocale=new h,this.calendar=[[{month:"01",title:this.jalaliLocale.monthNames[0]},{month:"02",title:this.jalaliLocale.monthNames[1]},{month:"03",title:this.jalaliLocale.monthNames[2]}],[{month:"04",title:this.jalaliLocale.monthNames[3]},{month:"05",title:this.jalaliLocale.monthNames[4]},{month:"06",title:this.jalaliLocale.monthNames[5]}],[{month:"07",title:this.jalaliLocale.monthNames[6]},{month:"08",title:this.jalaliLocale.monthNames[7]},{month:"09",title:this.jalaliLocale.monthNames[8]}],[{month:"10",title:this.jalaliLocale.monthNames[9]},{month:"11",title:this.jalaliLocale.monthNames[10]},{month:"12",title:this.jalaliLocale.monthNames[11]}]],this.changed=new e.EventEmitter}return t.prototype.ngOnInit=function(){this.year=this.value.month?this.value.month.substr(0,4):this.service.jalali.now({format:"Y"}),this.current=this.service.jalali.now({format:"Y-M"});var t=[];this.config.required&&t.push(this.validate.bind(this)),this.form.addControl(this.name,new a.FormControl(this.value)),this.form.addControl(this.name+"-title",new a.FormControl("",t)),this.setTitle()},t.prototype.validate=function(){return this.value.month?null:{required:!0}},t.prototype.showCalendar=function(t){document.querySelector("#input"+this.random).blur(),this.reset&&(this.reset=!1,t=!1),this.show=t,this.show?(this.form.get(this.name+"-title").markAsUntouched(),this.year=this.value.month?this.value.month.substr(0,4):this.service.jalali.now({format:"Y"})):this.form.get(this.name+"-title").markAsTouched()},t.prototype.changeYear=function(t){var e=Number(this.year)+t;this.year=e<1e3?"1000":e.toString()},t.prototype.setTitle=function(){this.form.get(this.name).setValue(this.value);var t=this.service.getMonthTitle(this.value);this.form.get(this.name+"-title").setValue(t)},t.prototype.setMonth=function(t){this.value=this.service.getMonthValue(t?this.year+"-"+t:""),this.setTitle(),this.showCalendar(!1),this.changed.emit(this.value.month?this.value:null),this.form.get(this.name+"-title").updateValueAndValidity()},t}();f.decorators=[{type:e.Component,args:[{template:'<div class="ng-jalali-back" *ngIf="show" (click)="showCalendar(false)"></div>\n\n<div [formGroup]="form" [ngStyle]="{ display: \'none\' }">\n <input type="text" [formControlName]="name" />\n</div>\n\n<content class="ng-jalali" dir="rtl">\n <mat-form-field [ngStyle]="css.field" class="ng-jalali" [formGroup]="form" [appearance]="appearance">\n <mat-label [ngStyle]="{ fontFamily: css.font }">{{ label }}</mat-label>\n <input\n matInput\n id="input{{ random }}"\n type="text"\n [formControlName]="name + \'-title\'"\n (focus)="showCalendar(true)"\n [ngStyle]="css.input"\n class="ng-jalali"\n />\n <span *ngIf="config.reset && value.month !== \'\'" matSuffix (click)="setMonth(\'\'); reset = true">\n <button mat-button type="button" [ngStyle]="css.reset" class="ng-jalali-reset">x</button>\n </span>\n <mat-error [ngStyle]="{ fontFamily: css.font }" *ngIf="form.get(name + \'-title\').hasError(\'required\')">\n {{ config.error }}\n </mat-error>\n </mat-form-field>\n\n <div class="ng-jalali-calendar" [ngStyle]="css.box" [@calendar] *ngIf="show">\n <div class="ng-jalali-header">\n <div>\n <button\n mat-icon-button\n type="button"\n [ngStyle]="css.arrow"\n (click)="changeYear(-10)"\n [disabled]="year <= \'1010\'"\n >\n &lt;&lt;\n </button>\n </div>\n <div>\n <button\n mat-icon-button\n type="button"\n [ngStyle]="css.arrow"\n (click)="changeYear(-1)"\n [disabled]="year === \'1000\'"\n >\n &lt;\n </button>\n </div>\n <div class="ng-jalali-title" [ngStyle]="css.header">{{ year }}</div>\n <div>\n <button mat-icon-button type="button" [ngStyle]="css.arrow" (click)="changeYear(1)">&gt;</button>\n </div>\n <div>\n <button mat-icon-button type="button" [ngStyle]="css.arrow" (click)="changeYear(10)">&gt;&gt;</button>\n </div>\n </div>\n <mat-divider></mat-divider>\n <div *ngFor="let season of calendar" class="ng-jalali-month-season">\n <ng-container *ngFor="let month of season">\n <button\n mat-button\n type="button"\n [disabled]="\n (config.min && year + \'-\' + month.month < config.min) ||\n (config.max && year + \'-\' + month.month > config.max)\n "\n [ngClass]="{\n \'ng-jalali-selected\': year + \'-\' + month.month === value.month,\n \'ng-jalali-current\': year + \'-\' + month.month === current\n }"\n [ngStyle]="\n year + \'-\' + month.month === current\n ? css.current\n : year + \'-\' + month.month === value.month\n ? css.selected\n : css.item\n "\n (click)="setMonth(month.month)"\n >\n {{ month.title }}\n </button>\n </ng-container>\n </div>\n </div>\n</content>\n',animations:[l.trigger("calendar",[l.state("init",l.style({opacity:1,transform:"translateY(0) scaleY(1)"})),l.transition("void => *",[l.style({opacity:0,transform:"translateY(-45%) scaleY(0)"}),l.animate(100)]),l.transition("* => void",l.animate(100,l.style({opacity:0,transform:"translateY(-45%) scaleY(0)"})))])],styles:["div.ng-jalali-month-season{display:flex}div.ng-jalali-month-season button{flex:1;padding:.5rem 2rem}","div.ng-jalali-back{background-color:transparent;bottom:0;left:0;position:fixed;right:0;top:0;z-index:999}content.ng-jalali{display:block;position:relative}mat-form-field.ng-jalali{direction:rtl;margin:0;text-align:right;width:100%}input.ng-jalali{cursor:default;text-align:right}button.ng-jalali-reset{color:#555;line-height:30px;min-width:auto;padding:0 .5rem}div.ng-jalali-calendar{background-color:#fff;box-shadow:0 2px 4px -1px rgba(0,0,0,.2),0 4px 5px 0 rgba(0,0,0,.14),0 1px 10px 0 rgba(0,0,0,.12);direction:rtl;position:absolute;right:0;top:45px;z-index:1000}div.ng-jalali-header{align-items:center;display:flex}div.ng-jalali-header div{flex:1;padding:.5rem .2rem;text-align:center}div.ng-jalali-header div.ng-jalali-title{flex:3}button.ng-jalali-selected{background-color:#eee;border:1px solid #999}button.ng-jalali-current{color:#009}"]}]}],f.ctorParameters=function(){return[{type:m}]},f.propDecorators={changed:[{type:e.Output}]};var p=function(){function t(t,n,a){this.resolver=t,this.container=n,this.service=a,this.jalaliLocale=new h,this.changed=new e.EventEmitter}return t.prototype.ngOnInit=function(){this.form||(this.form=new a.FormGroup({})),this.name||(this.name="jalali-month-"+Date.now().toString()),this.appearance=this.service.checkAppearance(this.appearance),this.config||(this.config={}),this.config.required=!!this.config.required,this.config.min=this.service.checkMonth(this.config.min)?this.config.min:null,this.config.max=this.service.checkMonth(this.config.max)?this.config.max:null,this.config.reset=!1!==this.config.reset,this.config.error=this.config.error?this.config.error:this.jalaliLocale.required,this.css=this.service.checkCSS(this.css),this.month=this.service.checkMonth(this.month),this.label=this.label?this.label:this.jalaliLocale.month;var t=this.resolver.resolveComponentFactory(f);this.component=this.container.createComponent(t),this.component.instance.form=this.form,this.component.instance.name=this.name,this.component.instance.appearance=this.appearance,this.component.instance.config=this.config,this.component.instance.css=this.css,this.component.instance.value=this.service.getMonthValue(this.month),this.component.instance.label=this.label,this.component.instance.changed=this.changed},t}();p.decorators=[{type:e.Directive,args:[{selector:"[jalali-month]"}]}],p.ctorParameters=function(){return[{type:e.ComponentFactoryResolver},{type:e.ViewContainerRef},{type:m}]},p.propDecorators={form:[{type:e.Input}],name:[{type:e.Input}],appearance:[{type:e.Input}],config:[{type:e.Input}],css:[{type:e.Input}],month:[{type:e.Input}],label:[{type:e.Input}],changed:[{type:e.Output}]};var v=function(){function t(t){this.service=t,this.show=!1,this.random=Date.now().toString(),this.today="",this.reset=!1,this.jalaliLocale=new h,this.week=this.jalaliLocale.dayNames,this.changed=new e.EventEmitter}return t.prototype.ngOnInit=function(){this.custom={from:this.value.range?this.value.from:"",to:this.value.range?this.value.to:""},this.setCustomTitle(),this.fMonth=this.value.range?this.value.from.substr(0,7):this.service.jalali.now({format:"Y-M"}),this.fCalendar=this.service.getCalendar(this.fMonth),this.tMonth=this.value.range?this.value.to.substr(0,7):this.service.jalali.now({format:"Y-M"}),this.tCalendar=this.service.getCalendar(this.tMonth),this.today=this.service.jalali.now({format:"Y-M-D"});var t=[];this.config.required&&t.push(this.validate.bind(this)),this.form.addControl(this.name,new a.FormControl(this.value)),this.form.addControl(this.name+"-title",new a.FormControl("",t)),this.setTitle()},t.prototype.validate=function(){return this.value.range?null:{required:!0}},t.prototype.showCalendar=function(t){document.querySelector("#input"+this.random).blur(),this.reset&&(this.reset=!1,t=!1),this.show=t,this.show?(this.setCustomTitle(),this.form.get(this.name+"-title").markAsUntouched(),this.value.range?(this.fMonth=this.value.from.substr(0,7),this.fCalendar=this.service.getCalendar(this.fMonth),this.tMonth=this.value.to.substr(0,7),this.tCalendar=this.service.getCalendar(this.tMonth)):(this.fMonth=this.service.jalali.now({format:"Y-M"}),this.fCalendar=this.service.getCalendar(this.fMonth),this.tMonth=this.service.jalali.now({format:"Y-M"}),this.tCalendar=this.service.getCalendar(this.tMonth),this.setCustomDate("",""))):this.form.get(this.name+"-title").markAsTouched()},t.prototype.changeMonth=function(t,e){var n,a,i="",o="";switch(t){case"from":i=(n=c(this.fMonth.split("-"),2))[0],o=n[1];break;case"to":i=(a=c(this.tMonth.split("-"),2))[0],o=a[1]}for(var r=Number(i),s=Number(o)+e;s>12;)s-=12,r++;for(;s<1;)s+=12,r--;switch(t){case"from":this.fMonth=r.toString()+"-"+(s<10?"0":"")+s.toString(),this.fCalendar=this.service.getCalendar(this.fMonth);break;case"to":this.tMonth=r.toString()+"-"+(s<10?"0":"")+s.toString(),this.tCalendar=this.service.getCalendar(this.tMonth)}},t.prototype.setTitle=function(){this.form.get(this.name).setValue(this.value);var t=this.service.getRangeTitle(this.value);this.form.get(this.name+"-title").setValue(t)},t.prototype.setCustomTitle=function(){this.fTitle=this.custom.from?this.service.jalali.toTitle(this.service.jalaliToGregorian(this.custom.from)):this.jalaliLocale.notSpecified,this.tTitle=this.custom.to?this.service.jalali.toTitle(this.service.jalaliToGregorian(this.custom.to)):this.jalaliLocale.notSpecified},t.prototype.setCustomDate=function(t,e){t&&e&&t>=e||(this.custom.from=t,this.custom.to=e,this.setCustomTitle())},t.prototype.setRange=function(t){var e={format:"Y-M-D"},n="",a="",i=null;switch(t){case"current-week":for(i=this.service.jalaliToGregorian(this.today);6!==i.getDay();)i=new Date(i.getTime()-864e5);n=this.service.jalali.toString(i,e),a=this.service.jalali.toString(new Date(i.getTime()+5184e5),e);break;case"current-month":i=this.service.jalaliToGregorian(this.today.substr(0,8)+"01");var o=this.service.getDayInMonth(this.today.substr(0,7));n=this.service.jalali.toString(i,e),a=this.service.jalali.toString(new Date(i.getTime()+24*(o-1)*3600*1e3),e);break;case"last-7days":i=this.service.jalaliToGregorian(this.today),n=this.service.jalali.toString(new Date(i.getTime()-5184e5),e),a=this.service.jalali.toString(i,e);break;case"last-30days":i=this.service.jalaliToGregorian(this.today),n=this.service.jalali.toString(new Date(i.getTime()-25056e5),e),a=this.service.jalali.toString(i,e);break;case"next-7days":i=this.service.jalaliToGregorian(this.today),n=this.service.jalali.toString(i,e),a=this.service.jalali.toString(new Date(i.getTime()+5184e5),e);break;case"next-30days":i=this.service.jalaliToGregorian(this.today),n=this.service.jalali.toString(i,e),a=this.service.jalali.toString(new Date(i.getTime()+25056e5),e);break;case"custom":n=this.custom.from,a=this.custom.to}this.custom={from:n,to:a},this.value=this.service.getRangeValue(n,a),this.setTitle(),this.showCalendar(!1),this.changed.emit(this.value.range?this.value:null),this.form.get(this.name+"-title").updateValueAndValidity()},t}();v.decorators=[{type:e.Component,args:[{template:'<div class="ng-jalali-back" *ngIf="show" (click)="showCalendar(false)"></div>\n\n<div [formGroup]="form" [ngStyle]="{ display: \'none\' }">\n <input type="text" [formControlName]="name" />\n</div>\n\n<content class="ng-jalali" dir="rtl">\n <mat-form-field [ngStyle]="css.field" class="ng-jalali" [formGroup]="form" [appearance]="appearance">\n <mat-label [ngStyle]="{ fontFamily: css.font }">{{ label }}</mat-label>\n <input\n matInput\n id="input{{ random }}"\n type="text"\n [formControlName]="name + \'-title\'"\n (focus)="showCalendar(true)"\n [ngStyle]="css.input"\n class="ng-jalali"\n />\n <span *ngIf="config.reset && value.range !== \'\'" matSuffix (click)="setRange(\'reset\'); reset = true">\n <button mat-button type="button" [ngStyle]="css.reset" class="ng-jalali-reset">x</button>\n </span>\n <mat-error [ngStyle]="{ fontFamily: css.font }" *ngIf="form.get(name + \'-title\').hasError(\'required\')">\n {{ config.error }}\n </mat-error>\n </mat-form-field>\n\n <div class="ng-jalali-calendar" [ngStyle]="css.box" [@calendar] *ngIf="show">\n <div class="ng-jalali-range-tools">\n <button\n mat-button\n type="button"\n [ngStyle]="custom.from === \'\' || custom.to === \'\' ? css.range.custom : css.range.confirm"\n [disabled]="custom.from === \'\' || custom.to === \'\'"\n (click)="setRange(\'custom\')"\n class="ng-jalali-range-custom"\n >\n {{\n custom.from === \'\' || custom.to === \'\' ? jalaliLocale.rangeCustom : jalaliLocale.rangeCustomConfirm\n }}\n </button>\n <button mat-button type="button" [ngStyle]="css.range.tool" (click)="setRange(\'current-week\')">\n {{ jalaliLocale.rangeCurrentWeek }}\n </button>\n <button mat-button type="button" [ngStyle]="css.range.tool" (click)="setRange(\'current-month\')">\n {{ jalaliLocale.rangeCurrentMonth }}\n </button>\n <button mat-button type="button" [ngStyle]="css.range.tool" (click)="setRange(\'last-7days\')">\n {{ jalaliLocale.rangeLast7Days }}\n </button>\n <button mat-button type="button" [ngStyle]="css.range.tool" (click)="setRange(\'last-30days\')">\n {{ jalaliLocale.rangeLast30Days }}\n </button>\n <button mat-button type="button" [ngStyle]="css.range.tool" (click)="setRange(\'next-7days\')">\n {{ jalaliLocale.rangeNext7Days }}\n </button>\n <button mat-button type="button" [ngStyle]="css.range.tool" (click)="setRange(\'next-30days\')">\n {{ jalaliLocale.rangeNext30Days }}\n </button>\n </div>\n <div class="ng-jalali-range-custom">\n <div class="ng-jalali-range-from">\n <div class="ng-jalali-header">\n <div>\n <button\n mat-icon-button\n type="button"\n [ngStyle]="css.arrow"\n (click)="changeMonth(\'from\', -12)"\n [disabled]="fMonth.substr(0, 4) === \'1000\'"\n >\n &lt;&lt;\n </button>\n </div>\n <div>\n <button\n mat-icon-button\n type="button"\n [ngStyle]="css.arrow"\n (click)="changeMonth(\'from\', -1)"\n [disabled]="fMonth === \'1000-01\'"\n >\n &lt;\n </button>\n </div>\n <div class="ng-jalali-title" [ngStyle]="css.header">{{ fCalendar.title }}</div>\n <div>\n <button mat-icon-button type="button" [ngStyle]="css.arrow" (click)="changeMonth(\'from\', 1)">\n &gt;\n </button>\n </div>\n <div>\n <button mat-icon-button type="button" [ngStyle]="css.arrow" (click)="changeMonth(\'from\', 12)">\n &gt;&gt;\n </button>\n </div>\n </div>\n <div class="ng-jalali-range-header">\n <div [ngStyle]="css.range.name" *ngFor="let day of week">{{ day }}</div>\n </div>\n <section>\n <div *ngFor="let week of fCalendar.weeks" class="ng-jalali-range-week">\n <div *ngFor="let day of week.days" class="ng-jalali-range-day">\n <button\n mat-icon-button\n type="button"\n [disabled]="\n day.month !== fMonth ||\n (config.min && day.date < config.min) ||\n (config.max && day.date > config.max) ||\n (custom.to !== \'\' && day.date >= custom.to)\n "\n [ngClass]="{\n \'ng-jalali-selected\': day.date === custom.from,\n \'ng-jalali-current\': day.date === today\n }"\n [ngStyle]="\n day.date === today\n ? css.current\n : day.date === custom.from\n ? css.selected\n : css.item\n "\n (click)="setCustomDate(day.date, custom.to)"\n >\n {{ day.day }}\n </button>\n </div>\n </div>\n </section>\n <div class="ng-jalali-range-custom-title" [ngStyle]="css.range.date">{{ fTitle }}</div>\n </div>\n <div class="ng-jalali-range-to">\n <div class="ng-jalali-header">\n <div>\n <button\n mat-icon-button\n type="button"\n [ngStyle]="css.arrow"\n (click)="changeMonth(\'to\', -12)"\n [disabled]="tMonth.substr(0, 4) === \'1000\'"\n >\n &lt;&lt;\n </button>\n </div>\n <div>\n <button\n mat-icon-button\n type="button"\n [ngStyle]="css.arrow"\n (click)="changeMonth(\'to\', -1)"\n [disabled]="tMonth === \'1000-01\'"\n >\n &lt;\n </button>\n </div>\n <div class="ng-jalali-title" [ngStyle]="css.header">{{ tCalendar.title }}</div>\n <div>\n <button mat-icon-button type="button" [ngStyle]="css.arrow" (click)="changeMonth(\'to\', 1)">\n &gt;\n </button>\n </div>\n <div>\n <button mat-icon-button type="button" [ngStyle]="css.arrow" (click)="changeMonth(\'to\', 12)">\n &gt;&gt;\n </button>\n </div>\n </div>\n <div class="ng-jalali-range-header">\n <div [ngStyle]="css.range.name" *ngFor="let day of week">{{ day }}</div>\n </div>\n <section>\n <div *ngFor="let week of tCalendar.weeks" class="ng-jalali-range-week">\n <div *ngFor="let day of week.days" class="ng-jalali-range-day">\n <button\n mat-icon-button\n type="button"\n [disabled]="\n day.month !== tMonth ||\n (config.min && day.date < config.min) ||\n (config.max && day.date > config.max) ||\n (custom.from !== \'\' && day.date <= custom.from)\n "\n [ngClass]="{\n \'ng-jalali-selected\': day.date === custom.to,\n \'ng-jalali-current\': day.date === today\n }"\n [ngStyle]="\n day.date === today ? css.current : day.date === custom.to ? css.selected : css.item\n "\n (click)="setCustomDate(custom.from, day.date)"\n >\n {{ day.day }}\n </button>\n </div>\n </div>\n </section>\n <div class="ng-jalali-range-custom-title" [ngStyle]="css.range.date">{{ tTitle }}</div>\n </div>\n </div>\n </div>\n</content>\n',animations:[l.trigger("calendar",[l.state("init",l.style({opacity:1,transform:"translateY(0) scaleY(1)"})),l.transition("void => *",[l.style({opacity:0,transform:"translateY(-45%) scaleY(0)"}),l.animate(100)]),l.transition("* => void",l.animate(100,l.style({opacity:0,transform:"translateY(-45%) scaleY(0)"})))])],styles:["div.ng-jalali-range-tools{display:flex}div.ng-jalali-range-tools button{background-color:#fafafa;border-bottom:1px solid #ccc;border-radius:0;border-right:1px solid #ccc;flex:1;min-width:auto;padding:.5rem 0;text-align:center;white-space:normal}div.ng-jalali-range-tools button.ng-jalali-range-custom{background-color:#fff;border-width:0}div.ng-jalali-range-custom{display:flex;flex-direction:row}div.ng-jalali-range-from{flex:1;margin:0 0 0 .5rem}div.ng-jalali-range-to{flex:1;margin:0 .5rem 0 0}@media only screen and (max-width:800px){div.ng-jalali-range-custom{flex-direction:column}div.ng-jalali-range-from{flex:1;margin:0 0 .5rem}div.ng-jalali-range-to{flex:1;margin:.5rem 0 0}}div.ng-jalali-range-from,div.ng-jalali-range-to{display:flex;flex-direction:column}div.ng-jalali-range-from section,div.ng-jalali-range-to section{flex:1}div.ng-jalali-range-header{align-items:center;display:flex}div.ng-jalali-range-header div{background-color:#ddd;flex:1;padding:1rem .2rem;text-align:center}div.ng-jalali-range-week{display:flex}div.ng-jalali-range-day{flex:1;padding:.2rem;text-align:center}div.ng-jalali-range-custom-title{border-top:1px solid #ccc;font-size:14px;padding:1rem;text-align:center}@media only screen and (max-width:800px){div.ng-jalali-range-custom-title{border-bottom:1px solid #ccc;border-top-width:0}}","div.ng-jalali-back{background-color:transparent;bottom:0;left:0;position:fixed;right:0;top:0;z-index:999}content.ng-jalali{display:block;position:relative}mat-form-field.ng-jalali{direction:rtl;margin:0;text-align:right;width:100%}input.ng-jalali{cursor:default;text-align:right}button.ng-jalali-reset{color:#555;line-height:30px;min-width:auto;padding:0 .5rem}div.ng-jalali-calendar{background-color:#fff;box-shadow:0 2px 4px -1px rgba(0,0,0,.2),0 4px 5px 0 rgba(0,0,0,.14),0 1px 10px 0 rgba(0,0,0,.12);direction:rtl;position:absolute;right:0;top:45px;z-index:1000}div.ng-jalali-header{align-items:center;display:flex}div.ng-jalali-header div{flex:1;padding:.5rem .2rem;text-align:center}div.ng-jalali-header div.ng-jalali-title{flex:3}button.ng-jalali-selected{background-color:#eee;border:1px solid #999}button.ng-jalali-current{color:#009}"]}]}],v.ctorParameters=function(){return[{type:m}]},v.propDecorators={changed:[{type:e.Output}]};var y=function(){function t(t,n,a){this.resolver=t,this.container=n,this.service=a,this.jalaliLocale=new h,this.changed=new e.EventEmitter}return t.prototype.ngOnInit=function(){this.form||(this.form=new a.FormGroup({})),this.name||(this.name="jalali-range-"+Date.now().toString()),this.appearance=this.service.checkAppearance(this.appearance),this.config||(this.config={}),this.config.required=!!this.config.required,this.config.min=this.service.checkDate(this.config.min)?this.config.min:null,this.config.max=this.service.checkDate(this.config.max)?this.config.max:null,this.config.reset=!1!==this.config.reset,this.config.error=this.config.error?this.config.error:this.jalaliLocale.required,this.css=this.service.checkCSS(this.css),this.from=this.service.checkDate(this.from),this.to=this.service.checkDate(this.to),this.label=this.label?this.label:this.jalaliLocale.range;var t=this.resolver.resolveComponentFactory(v);this.component=this.container.createComponent(t),this.component.instance.form=this.form,this.component.instance.name=this.name,this.component.instance.appearance=this.appearance,this.component.instance.config=this.config,this.component.instance.css=this.css,this.component.instance.value=this.service.getRangeValue(this.from,this.to),this.component.instance.label=this.label,this.component.instance.changed=this.changed},t}();y.decorators=[{type:e.Directive,args:[{selector:"[jalali-range]"}]}],y.ctorParameters=function(){return[{type:e.ComponentFactoryResolver},{type:e.ViewContainerRef},{type:m}]},y.propDecorators={form:[{type:e.Input}],name:[{type:e.Input}],appearance:[{type:e.Input}],config:[{type:e.Input}],css:[{type:e.Input}],from:[{type:e.Input}],to:[{type:e.Input}],label:[{type:e.Input}],changed:[{type:e.Output}]};var b=function(){function t(t){this.service=t}return t.prototype.transform=function(t){var e=t.split(" "),n=e[0],a=e[1]&&this.service.checkTime(e[1])?e[1]:"00:00:00";return this.service.checkDate(n)?this.service.jalaliToGregorian(n,a).toString():""},t}();b.decorators=[{type:e.Pipe,args:[{name:"jalaliDate"}]}],b.ctorParameters=function(){return[{type:m}]};var j=function(){function t(t){this.service=t}return t.prototype.transform=function(t){var e=t.split(" "),n=e[0],a=e[1]&&this.service.checkTime(e[1])?e[1]:"00:00:00";if(!this.service.checkDate(n))return"";var i=this.service.jalaliToGregorian(n,a);return Math.floor(i.getTime()/1e3).toString()},t}();j.decorators=[{type:e.Pipe,args:[{name:"jalaliTimestamp"}]}],j.ctorParameters=function(){return[{type:m}]};var x=function(){function t(t){this.service=t}return t.prototype.transform=function(t,e){var n;switch(typeof t){case"number":n=new Date(1e3*t);break;case"string":if(!this.service.checkDate(t))return"";n=this.service.jalaliToGregorian(t)}return e=e||"W، D N Y",this.service.jalali.toTitle(n,{format:e})},t}();x.decorators=[{type:e.Pipe,args:[{name:"jalaliTitle"}]}],x.ctorParameters=function(){return[{type:m}]};var w=function(){function t(t){this.service=t}return t.prototype.transform=function(t,e){var n;switch(typeof t){case"number":n=new Date(1e3*t);break;case"string":var a=t.split(" "),i=a[0],o=a[1]?a[1]:"00:00:00";if(!this.service.checkDate(i))return"";n=this.service.jalaliToGregorian(i,o)}return e=e||"W، D N Y H:I:S",this.service.jalali.toFullText(n,{format:e})},t}();w.decorators=[{type:e.Pipe,args:[{name:"jalaliFull"}]}],w.ctorParameters=function(){return[{type:m}]};var S=function(){function t(t){this.service=t}return t.prototype.transform=function(t){if(!this.service.checkMonth(t))return"";var e=this.service.jalaliToGregorian(t+"-01");return this.service.jalali.toTitle(e,{format:"N Y"})},t}();S.decorators=[{type:e.Pipe,args:[{name:"jalaliMonth"}]}],S.ctorParameters=function(){return[{type:m}]};var k=function(){function t(t){this.service=t}return t.prototype.transform=function(t){var e=t.split("|"),n=e[0],a=e[1]?e[1]:"";return this.service.checkDate(n)&&this.service.checkDate(a)?this.service.getRangeTitle(this.service.getRangeValue(n,a)):""},t}();k.decorators=[{type:e.Pipe,args:[{name:"jalaliRange"}]}],k.ctorParameters=function(){return[{type:m}]};var T=function(){function t(t){this.service=t}return t.prototype.transform=function(t){var e=t.split("|"),n=e[0],a=e[1]&&this.service.checkDate(e[1])?e[1]:"";if(!this.service.checkDate(n))return"";var i=this.service.jalali.now({format:"H:I:S"}),o=this.service.jalaliToGregorian(n,i),r=a?this.service.jalaliToGregorian(a,i):new Date,s=Math.abs(Math.floor(o.getTime()/1e3)-Math.floor(r.getTime()/1e3));return(Math.floor(s/86400)+1).toString()},t}();T.decorators=[{type:e.Pipe,args:[{name:"jalaliDays"}]}],T.ctorParameters=function(){return[{type:m}]};var C=function(){};C.decorators=[{type:e.NgModule,args:[{declarations:[g,u,f,p,v,y,b,j,x,w,S,k,T],providers:[m],imports:[n.CommonModule,a.ReactiveFormsModule,d],exports:[u,p,y,b,j,x,w,S,k,T],entryComponents:[g,f,v]}]}],t.NgJalaliDateTimeModule=C,t.ɵa=g,t.ɵb=m,t.ɵc=u,t.ɵd=f,t.ɵe=p,t.ɵf=v,t.ɵg=y,t.ɵh=b,t.ɵi=j,t.ɵj=x,t.ɵk=w,t.ɵl=S,t.ɵm=k,t.ɵn=T,t.ɵo=d,Object.defineProperty(t,"__esModule",{value:!0})})); //# sourceMappingURL=ng-jalali-date-time.umd.min.js.map