Skip to content

Commit c745a31

Browse files
refactor: simplify and format code
1 parent aad6f03 commit c745a31

3 files changed

Lines changed: 9 additions & 12 deletions

File tree

docs/Configuration/Views/current,-upcoming.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ You can use all of common fields of [View](../View.md) in these views also.
4242
mode: "upcoming",
4343
position: "top_left",
4444
slotTitle: "Upcoming Events",
45-
maxItems:5,
46-
maxDays:7,
47-
slotMaxHeight:"180px",
48-
hideOverflow:true,
45+
maxItems: 5,
46+
maxDays: 7,
47+
slotMaxHeight: "180px",
48+
hideOverflow: true,
4949
},
5050
```
5151

eslint.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export default defineConfig([
1919
"plugins": {js, stylistic},
2020
"extends": [importX.recommended, "js/all", "stylistic/all"],
2121
"rules": {
22+
"@stylistic/array-element-newline": ["error", "consistent"],
2223
"@stylistic/dot-location": ["error", "property"],
2324
"@stylistic/function-call-argument-newline": ["error", "consistent"],
2425
"@stylistic/function-paren-newline": ["error", "consistent"],

node_helper.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ module.exports = NodeHelper.create({
140140
return;
141141
}
142142

143-
const wholeEvents = [].concat(events.events, events.occurrences);
143+
const wholeEvents = [...events.events, ...events.occurrences];
144144
const eventPool = [];
145145

146146
wholeEvents.forEach((item) => {
@@ -171,12 +171,8 @@ module.exports = NodeHelper.create({
171171
let startDate;
172172
let endDate;
173173
if (calendar.forceLocalTZ) {
174-
const ts = item.startDate.toJSON();
175-
ts.month -= 1;
176-
const te = item.endDate.toJSON();
177-
te.month -= 1;
178-
startDate = moment(ts);
179-
endDate = moment(te);
174+
startDate = moment(item.startDate.toJSDate()).subtract(1, "months");
175+
endDate = moment(item.endDate.toJSDate()).subtract(1, "months");
180176
} else {
181177
startDate = moment(item.startDate.toJSDate());
182178
endDate = moment(item.endDate.toJSDate());
@@ -204,7 +200,7 @@ module.exports = NodeHelper.create({
204200
ev.isFullday = isFullday;
205201

206202
// import the Microsoft property X-MICROSOFT-CDO-BUSYSTATUS, fall back to "BUSY" in case none was found
207-
// possible values are 'FREE'|'TENTATIVE'|'BUSY'|'OOF' acording to
203+
// possible values are 'FREE'|'TENTATIVE'|'BUSY'|'OOF' according to
208204
// https://docs.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-oxcical/cd68eae7-ed65-4dd3-8ea7-ad585c76c736
209205
ev.ms_busystatus =
210206
ri.component.getFirstPropertyValue("x-microsoft-cdo-busystatus") ||

0 commit comments

Comments
 (0)