Skip to content

Commit 5e97073

Browse files
committed
fix for no events
1 parent 4b1b457 commit 5e97073

File tree

1 file changed

+4
-2
lines changed
  • frameos/src/apps/data/eventsToAgenda

1 file changed

+4
-2
lines changed

frameos/src/apps/data/eventsToAgenda/app.nim

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,17 @@ proc get*(self: App, context: ExecutionContext): string =
4141
proc h1(text: string): string = &"{title}{text}\n{normal}\n"
4242
proc formatDay(day: string): string = format(parseTs("{year/4}-{month/2}-{day/2}", day), titleFormat)
4343

44+
let noEvents = events == nil or events.kind != JArray or events.len == 0
45+
4446
result = ""
4547

4648
var currentDay = ""
47-
if self.appConfig.startWithToday:
49+
if self.appConfig.startWithToday or noEvents:
4850
let todayTs = epochTime().Timestamp
4951
result &= h1(format(todayTs, titleFormat, tzName = timezone))
5052
currentDay = format(todayTs, "{year/4}-{month/2}-{day/2}", tzName = timezone)
5153

52-
if events == nil or events.kind != JArray or events.len == 0:
54+
if noEvents:
5355
result &= &"No events found\n"
5456
return
5557

0 commit comments

Comments
 (0)