From df41f60101817a5ea427b7aa79890913f1f04106 Mon Sep 17 00:00:00 2001 From: Franco Speziali Date: Thu, 17 Mar 2022 21:47:46 +0100 Subject: [PATCH] Default to day grouping if no setting is provided --- src/Calendar/index.ts | 3 ++- src/Config/Config.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Calendar/index.ts b/src/Calendar/index.ts index 1229d31..cfe2a45 100644 --- a/src/Calendar/index.ts +++ b/src/Calendar/index.ts @@ -1,3 +1,4 @@ +import { GroupTypes } from "../types"; import Config from "../Config/Config"; import Events from "../Events/"; import EventGrouping from "../EventGrouping"; @@ -11,7 +12,7 @@ export default class Calendar { constructor(json) { this.jsonContent = json; this.config = new Config({ - groupTypes: json["group"].charAt(0), + groupTypes: json["group"] ? json["group"].charAt(0) : GroupTypes.Day, }); this.events = new Events(json["events"]); this.eventGrouping = new EventGrouping( diff --git a/src/Config/Config.ts b/src/Config/Config.ts index fa65db6..60c7298 100644 --- a/src/Config/Config.ts +++ b/src/Config/Config.ts @@ -4,6 +4,6 @@ export default class Config { groupTypes: GroupTypes; constructor({ groupTypes }) { - this.groupTypes = groupTypes.toUpperCase() || GroupTypes.Week; + this.groupTypes = groupTypes.toUpperCase(); } }