@salesforcedevs/dw-components 1.3.20 → 1.3.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/dw-components",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.26",
|
|
4
4
|
"description": "Lightning web components for https://developer.salesforce.com",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
"@types/lodash.orderby": "^4.6.7",
|
|
23
23
|
"@types/lodash.uniqby": "^4.7.7"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "31be8a973c75cec3678c6ec7308fb6099b29d055"
|
|
26
26
|
}
|
|
@@ -1,24 +1,11 @@
|
|
|
1
1
|
import { api, LightningElement } from "lwc";
|
|
2
|
+
import { DateTime } from "luxon";
|
|
2
3
|
import { toJson } from "dxUtils/normalizers";
|
|
4
|
+
import { convertForDaylightSavings } from "dxUtils/dates";
|
|
3
5
|
import qs from "query-string";
|
|
4
6
|
import uniqBy from "lodash.uniqby";
|
|
5
7
|
import orderBy from "lodash.orderby";
|
|
6
8
|
|
|
7
|
-
const MONTH_NAMES = [
|
|
8
|
-
"January",
|
|
9
|
-
"February",
|
|
10
|
-
"March",
|
|
11
|
-
"April",
|
|
12
|
-
"May",
|
|
13
|
-
"June",
|
|
14
|
-
"July",
|
|
15
|
-
"August",
|
|
16
|
-
"September",
|
|
17
|
-
"October",
|
|
18
|
-
"November",
|
|
19
|
-
"December"
|
|
20
|
-
];
|
|
21
|
-
|
|
22
9
|
export default abstract class EventsList extends LightningElement {
|
|
23
10
|
private _events: any[] = [];
|
|
24
11
|
private monthsList: any[] = [];
|
|
@@ -31,11 +18,11 @@ export default abstract class EventsList extends LightningElement {
|
|
|
31
18
|
return (
|
|
32
19
|
this._events
|
|
33
20
|
.filter((event) => {
|
|
34
|
-
const date =
|
|
35
|
-
const eventDate = `${MONTH_NAMES[date.getUTCMonth()]}`;
|
|
21
|
+
const date = DateTime.fromISO(event.startDate);
|
|
36
22
|
return (
|
|
37
|
-
this.selectedMonths.includes(
|
|
38
|
-
|
|
23
|
+
this.selectedMonths.includes(
|
|
24
|
+
date.toFormat("LLLL yyyy")
|
|
25
|
+
) && this.selectedEventTypes.includes(event.type)
|
|
39
26
|
);
|
|
40
27
|
})
|
|
41
28
|
// some url stubs don't have /events/ prepended to the url
|
|
@@ -61,17 +48,31 @@ export default abstract class EventsList extends LightningElement {
|
|
|
61
48
|
}
|
|
62
49
|
|
|
63
50
|
get upcomingEvents() {
|
|
64
|
-
const today =
|
|
65
|
-
|
|
51
|
+
const today = DateTime.local().toISO();
|
|
52
|
+
const test = this._filteredEvents.filter((event) => {
|
|
53
|
+
return (
|
|
54
|
+
convertForDaylightSavings(event.endDate) >=
|
|
55
|
+
DateTime.fromISO(today)
|
|
56
|
+
);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
return test;
|
|
66
60
|
}
|
|
67
61
|
|
|
68
62
|
get pastEvents() {
|
|
69
|
-
const today =
|
|
70
|
-
|
|
71
|
-
this._filteredEvents.filter((event) =>
|
|
72
|
-
|
|
63
|
+
const today = DateTime.local().toISO();
|
|
64
|
+
const test = orderBy(
|
|
65
|
+
this._filteredEvents.filter((event) => {
|
|
66
|
+
return (
|
|
67
|
+
convertForDaylightSavings(event.endDate) <=
|
|
68
|
+
DateTime.fromISO(today)
|
|
69
|
+
);
|
|
70
|
+
}),
|
|
71
|
+
["endDate"],
|
|
73
72
|
["desc"]
|
|
74
73
|
);
|
|
74
|
+
|
|
75
|
+
return test;
|
|
75
76
|
}
|
|
76
77
|
|
|
77
78
|
get shownEventsTotal() {
|
|
@@ -95,15 +96,19 @@ export default abstract class EventsList extends LightningElement {
|
|
|
95
96
|
window.removeEventListener("popstate", this.handleURLStateChange);
|
|
96
97
|
}
|
|
97
98
|
|
|
99
|
+
convertForDaylightSavings(date: string) {
|
|
100
|
+
return DateTime.fromISO(date).isInDST
|
|
101
|
+
? DateTime.fromISO(date).toLocal()
|
|
102
|
+
: DateTime.fromISO(date).toLocal().plus({ hour: 1 });
|
|
103
|
+
}
|
|
104
|
+
|
|
98
105
|
createMonthsList() {
|
|
99
106
|
return this._events.map((event) => {
|
|
100
|
-
const date =
|
|
107
|
+
const date = DateTime.fromISO(event.startDate);
|
|
101
108
|
return {
|
|
102
109
|
rawDate: date,
|
|
103
|
-
value:
|
|
104
|
-
label:
|
|
105
|
-
MONTH_NAMES[date.getUTCMonth()]
|
|
106
|
-
} ${date.getUTCFullYear()}`
|
|
110
|
+
value: date.toFormat("LLLL yyyy"),
|
|
111
|
+
label: date.toFormat("LLLL yyyy")
|
|
107
112
|
};
|
|
108
113
|
});
|
|
109
114
|
}
|