Improve events and align date a bit
ci/woodpecker/push/woodpecker Pipeline was successful Details

This commit is contained in:
Jan Zípek 2024-06-03 17:17:19 +02:00
parent 8d983a4664
commit a7b1e659e8
Signed by: kamen
GPG Key ID: A17882625B33AC31
2 changed files with 12 additions and 3 deletions

View File

@ -103,7 +103,7 @@ export const dowRoutes = router((router, ctx) => {
}, },
{ {
x: WIDTH / 2, x: WIDTH / 2,
y: 145, y: 140,
c: `${ c: `${
Math.round((weather.now?.temperature as number) ?? 0) ?? '-' Math.round((weather.now?.temperature as number) ?? 0) ?? '-'
} C ${summary}`, } C ${summary}`,

View File

@ -21,7 +21,11 @@ export const calendarService = service((ctx) => async () => {
events: async (calendars: string[]) => { events: async (calendars: string[]) => {
const results = [] const results = []
const timeMin = DateTime.now().setZone(ctx.config.timeZone).startOf('day')
const timeMin = DateTime.now()
.setZone(ctx.config.timeZone)
.minus({ minutes: 30 })
const timeMax = DateTime.now().setZone(ctx.config.timeZone).endOf('day') const timeMax = DateTime.now().setZone(ctx.config.timeZone).endOf('day')
if (!timeMin.isValid) { if (!timeMin.isValid) {
@ -47,7 +51,12 @@ export const calendarService = service((ctx) => async () => {
} }
} }
return results return results.sort((a, b) => {
const aDate = new Date(a.start?.dateTime ?? a.start?.date ?? 0)
const bDate = new Date(b.start?.dateTime ?? b.start?.date ?? 0)
return aDate.toISOString().localeCompare(bDate.toISOString())
})
}, },
} }
}) })