Skip to content

Commit

Permalink
fix settings not loading if no calendar.days.json file exists
Browse files Browse the repository at this point in the history
  • Loading branch information
gfwilliams committed Oct 19, 2023
1 parent 9da07b3 commit 503516e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apps/calendar/settings.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
(function (back) {
var FILE = "calendar.json";
const HOLIDAY_FILE = "calendar.days.json";
var settings = require('Storage').readJSON(FILE, true) || {};
var settings = require('Storage').readJSON(FILE, 1) || {};
if (settings.ndColors === undefined)
if (process.env.HWVERSION == 2) {
settings.ndColors = true;
} else {
settings.ndColors = false;
}
const holidays = require("Storage").readJSON(HOLIDAY_FILE,1).sort((a,b) => new Date(a.date) - new Date(b.date)) || [];
const holidays = (require("Storage").readJSON(HOLIDAY_FILE,1)||[]).sort((a,b) => new Date(a.date) - new Date(b.date)) || [];

function writeSettings() {
require('Storage').writeJSON(FILE, settings);
Expand Down

0 comments on commit 503516e

Please sign in to comment.