1- import  {  Component ,  OnInit  }  from  ' @angular/core' ; 
2- import  {  Options  }  from  ' angular-datetimerangepicker/types' ; 
1+ import  {  Component ,  OnInit  }  from  " @angular/core" ; 
2+ import  {  Options  }  from  " angular-datetimerangepicker/types" ; 
33declare  var  require : any ; 
4- const  dayjs  =  require ( ' dayjs' ) ; 
4+ const  dayjs  =  require ( " dayjs" ) ; 
55
66@Component ( { 
7-  selector : ' app-root' , 
8-  templateUrl : ' ./app.component.html' , 
9-  styleUrls : [ ' ./app.component.css' ] , 
7+  selector : " app-root" , 
8+  templateUrl : " ./app.component.html" , 
9+  styleUrls : [ " ./app.component.css" ] , 
1010} ) 
1111export  class  AppComponent  implements  OnInit  { 
1212 isTimePickerEnabled  =  true ; 
13-  format  =  ' DD.MM.YYYY HH:mm' ; 
13+  format  =  " DD.MM.YYYY HH:mm" ; 
1414 themeObject  =  { 
15-  ' --drp-bg' null , 
16-  ' --drp-fg' null , 
17-  ' --drp-hover-bg' null , 
18-  ' --drp-hover-fg' null , 
19-  ' --drp-shadow-color' null , 
20-  ' --drp-outline-color' null , 
21-  ' --drp-input-border-color' null , 
22-  ' --drp-input-disabled-color' null , 
15+  " --drp-bg" null , 
16+  " --drp-fg" null , 
17+  " --drp-hover-bg" null , 
18+  " --drp-hover-fg" null , 
19+  " --drp-shadow-color" null , 
20+  " --drp-outline-color" null , 
21+  " --drp-input-border-color" null , 
22+  " --drp-input-disabled-color" null , 
2323 } ; 
2424 initialConfigDatePickerOptions : any  =  { 
2525 format : this . format , 
2626 singleCalendar : true , 
2727 displayFormat : this . format , 
28-  position : ' left' , 
28+  position : " left" , 
2929 noDefaultRangeSelected : true , 
3030 timePicker : { 
3131 minuteInterval : 1 , 
@@ -46,29 +46,29 @@ export class AppComponent implements OnInit {
4646 } ; 
4747 daterangepickerOptions : any  =  { 
4848 startDate : dayjs ( ) , 
49-  endDate : dayjs ( ) . add ( 10 ,  ' days' ) , 
50-  minDate : dayjs ( ) . add ( - 12 ,  ' months' ) , 
51-  maxDate : dayjs ( ) . add ( 12 ,  ' months' ) , 
49+  endDate : dayjs ( ) . add ( 10 ,  " days" ) , 
50+  minDate : dayjs ( ) . add ( - 12 ,  " months" ) , 
51+  maxDate : dayjs ( ) . add ( 12 ,  " months" ) , 
5252 format : this . format , 
5353 displayFormat : this . format , 
5454 autoApply : true , 
55-  theme : ' dark' , 
55+  theme : " dark" , 
5656 weekStartsOn : 0 , 
57-  placeholder : ' demo placeholder' , 
57+  placeholder : " demo placeholder" , 
5858 hideControls : false , 
5959 singleCalendar : false , 
60-  position : ' left' , 
60+  position : " left" , 
6161 required : false , 
6262 readOnly : true , 
6363 disabled : false , 
6464 disableWeekEnds : true , 
6565 disabledDays : [ 3 ] , 
6666 disabledDates : [ 
67-  dayjs ( ) . add ( 10 ,  ' day' ) , 
68-  dayjs ( ) . add ( 11 ,  ' day' ) , 
69-  dayjs ( ) . add ( 12 ,  ' day' ) , 
70-  dayjs ( ) . add ( 13 ,  ' day' ) , 
71-  dayjs ( ) . add ( 14 ,  ' day' ) , 
67+  dayjs ( ) . add ( 10 ,  " day" ) , 
68+  dayjs ( ) . add ( 11 ,  " day" ) , 
69+  dayjs ( ) . add ( 12 ,  " day" ) , 
70+  dayjs ( ) . add ( 13 ,  " day" ) , 
71+  dayjs ( ) . add ( 14 ,  " day" ) , 
7272 ] , 
7373 disableBeforeStart : false , 
7474 inactiveBeforeStart : true , 
@@ -82,45 +82,45 @@ export class AppComponent implements OnInit {
8282 } , 
8383 preDefinedRanges : [ 
8484 { 
85-  name : ' Day After tomorrow' , 
85+  name : " Day After tomorrow" , 
8686 value : { 
87-  start : dayjs ( ) . add ( 2 ,  ' days' ) , 
88-  end : dayjs ( ) . add ( 2 ,  ' days' ) , 
87+  start : dayjs ( ) . add ( 2 ,  " days" ) , 
88+  end : dayjs ( ) . add ( 2 ,  " days" ) , 
8989 } , 
9090 } , 
9191 { 
92-  name : ' Today' , 
92+  name : " Today" , 
9393 value : { 
9494 start : dayjs ( ) , 
9595 end : dayjs ( ) , 
9696 } , 
9797 } , 
9898 { 
99-  name : ' Tomorrow' , 
99+  name : " Tomorrow" , 
100100 value : { 
101-  start : dayjs ( ) . add ( 1 ,  ' days' ) , 
102-  end : dayjs ( ) . add ( 1 ,  ' days' ) , 
101+  start : dayjs ( ) . add ( 1 ,  " days" ) , 
102+  end : dayjs ( ) . add ( 1 ,  " days" ) , 
103103 } , 
104104 } , 
105105 { 
106-  name : ' This week' , 
106+  name : " This week" , 
107107 value : { 
108108 start : dayjs ( ) , 
109-  end : dayjs ( ) . add ( 7 ,  ' days' ) , 
109+  end : dayjs ( ) . add ( 7 ,  " days" ) , 
110110 } , 
111111 } , 
112112 { 
113-  name : ' This month' , 
113+  name : " This month" , 
114114 value : { 
115115 start : dayjs ( ) , 
116-  end : dayjs ( ) . add ( 1 ,  ' month' ) , 
116+  end : dayjs ( ) . add ( 1 ,  " month" ) , 
117117 } , 
118118 } , 
119119 { 
120-  name : ' Next 2 months' , 
120+  name : " Next 2 months" , 
121121 value : { 
122122 start : dayjs ( ) , 
123-  end : dayjs ( ) . add ( 2 ,  ' month' ) , 
123+  end : dayjs ( ) . add ( 2 ,  " month" ) , 
124124 } , 
125125 } , 
126126 ] , 
@@ -131,9 +131,9 @@ export class AppComponent implements OnInit {
131131 } ; 
132132 ngOnInit ( )  { 
133133 for  ( const  prop  in  this . themeObject )  { 
134-  this . themeObject [ prop ]  =  getComputedStyle ( 
135-  document . documentElement 
136-  ) . getPropertyValue ( prop ) ; 
134+  this . themeObject [ prop ]  =  getComputedStyle ( document . documentElement ) 
135+  . getPropertyValue ( prop ) 
136+  . trim ( ) ; 
137137 } 
138138 } 
139139 rangeSelected ( data )  { 
@@ -161,19 +161,10 @@ export class AppComponent implements OnInit {
161161 : null ; 
162162 } 
163163 prettyPrintJSON ( object )  { 
164-  return  JSON . stringify ( 
165-  object , 
166-  ( key ,  val )  =>  { 
167-  if  ( val  &&  dayjs ( val ) . isValid ( ) )  { 
168-  return  `dayjs('${ val }  ; 
169-  } 
170-  return  val ; 
171-  } , 
172-  2 
173-  ) ; 
164+  return  JSON . stringify ( object ,  null ,  2 ) ; 
174165 } 
175166 colorChange ( e )  { 
176-  this . daterangepickerOptions . theme  =  ' light' ; 
167+  this . daterangepickerOptions . theme  =  " light" ; 
177168 this . themeObject [ e . target . dataset . cssPropName ]  =  e . target . value ; 
178169 document . documentElement . style . setProperty ( 
179170 e . target . dataset . cssPropName , 
@@ -187,7 +178,7 @@ export class AppComponent implements OnInit {
187178 ? event . start . format ( this . format ) 
188179 : event . target . checked , 
189180 } ; 
190-  if  ( [ ' minDate' , ' maxDate' ] . includes ( propValue ) )  { 
181+  if  ( [ " minDate" , " maxDate" ] . includes ( propValue ) )  { 
191182 this . endDateConfigDatePickerOptions  =  { 
192183 ...this . endDateConfigDatePickerOptions , 
193184 noDefaultRangeSelected : false , 
@@ -210,7 +201,7 @@ export class AppComponent implements OnInit {
210201 } 
211202 disabledDaysChanged ( event )  { 
212203 this . daterangepickerOptions . disabledDays  =  event . target . value 
213-  ? event . target . value . split ( ',' ) . map ( ( x )  =>  + x ) 
204+  ? event . target . value . split ( "," ) . map ( ( x )  =>  + x ) 
214205 : null ; 
215206 } 
216207} 
0 commit comments