Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 44d4ba2

Browse files
fix: Added dayjs constructor statement to the config generator
configuration section
1 parent f99d0ad commit 44d4ba2

File tree

1 file changed

+43
-44
lines changed

1 file changed

+43
-44
lines changed

‎src/app/app.component.ts‎

Lines changed: 43 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
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';
33
declare 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
})
1111
export 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
],
@@ -164,7 +164,6 @@ export class AppComponent implements OnInit {
164164
return JSON.stringify(
165165
object,
166166
(key, val) => {
167-
console.log(key, val);
168167
if (val && dayjs(val).isValid()) {
169168
return `dayjs('${val}')`;
170169
}
@@ -174,7 +173,7 @@ export class AppComponent implements OnInit {
174173
);
175174
}
176175
colorChange(e) {
177-
this.daterangepickerOptions.theme = "light";
176+
this.daterangepickerOptions.theme = 'light';
178177
this.themeObject[e.target.dataset.cssPropName] = e.target.value;
179178
document.documentElement.style.setProperty(
180179
e.target.dataset.cssPropName,
@@ -188,7 +187,7 @@ export class AppComponent implements OnInit {
188187
? event.start.format(this.format)
189188
: event.target.checked,
190189
};
191-
if (["minDate","maxDate"].includes(propValue)) {
190+
if (['minDate','maxDate'].includes(propValue)) {
192191
this.endDateConfigDatePickerOptions = {
193192
...this.endDateConfigDatePickerOptions,
194193
noDefaultRangeSelected: false,
@@ -211,7 +210,7 @@ export class AppComponent implements OnInit {
211210
}
212211
disabledDaysChanged(event) {
213212
this.daterangepickerOptions.disabledDays = event.target.value
214-
? event.target.value.split(",").map((x) => +x)
213+
? event.target.value.split(',').map((x) => +x)
215214
: null;
216215
}
217216
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /