Skip to content
This repository was archived by the owner on Sep 25, 2021. It is now read-only.

Commit ee416f4

Browse files
committed
compatibility fix
1 parent f1b3706 commit ee416f4

2 files changed

Lines changed: 30 additions & 28 deletions

File tree

app.js

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,30 @@ class AtomicCalendar extends LitElement {
2222
this.firstrun = true
2323
}
2424

25-
set hass(hass) {
26-
if(!this._hass) this._hass=hass
27-
if(this.firstrun){
28-
let timeFormat = moment.localeData(this._hass.language).longDateFormat('LT')
25+
26+
27+
static get properties() {
28+
return {
29+
hass: Object,
30+
config: Object,
31+
content: Object,
32+
selectedMonth: Object
33+
}
34+
}
35+
36+
37+
38+
updated() {}
39+
40+
render() {
41+
42+
43+
if(this.firstrun){
44+
let timeFormat = moment.localeData(this.hass.language).longDateFormat('LT')
2945
if (this.config.hoursFormat=='12h') timeFormat = 'h:mm A'
3046
else if (this.config.hoursFormat=='24h') timeFormat = 'H:mm'
3147
else if(this.config.hoursFormat!='default') timeFormat = this.config.hoursFormat
32-
moment.updateLocale(this._hass.language, {
48+
moment.updateLocale(this.hass.language, {
3349
week: {
3450
dow: this.config.firstDayOfWeek
3551
},
@@ -41,25 +57,11 @@ class AtomicCalendar extends LitElement {
4157
let start = moment().add(this.config.startDaysAhead, 'days').startOf('day').format('YYYY-MM-DDTHH:mm:ss');
4258
let end = moment().add((this.config.maxDaysToShow + this.config.startDaysAhead), 'days').endOf('day').format('YYYY-MM-DDTHH:mm:ss');
4359
this.firstrun=false
44-
console.log("atomic_calendar v0.7.4 loaded")
60+
console.log("atomic_calendar v0.7.4a loaded")
4561
}
46-
}
47-
48-
static get properties() {
49-
return {
50-
_hass: {},
51-
config: Object,
52-
content: Object,
53-
selectedMonth: Object
54-
}
55-
}
56-
57-
58-
59-
updated() {}
60-
61-
render() {
62-
62+
63+
64+
6365

6466
if (!this.isUpdating && this.modeToggle == 1) {
6567
if (!this.lastEventsUpdateTime || moment().diff(this.lastEventsUpdateTime, 'minutes') > 15)
@@ -491,7 +493,7 @@ class AtomicCalendar extends LitElement {
491493
}
492494

493495
_toggle(state) {
494-
this._hass.callService('homeassistant', 'toggle', {
496+
this.hass.callService('homeassistant', 'toggle', {
495497
entity_id: state.entity_id
496498
});
497499
}
@@ -691,7 +693,7 @@ class AtomicCalendar extends LitElement {
691693
`calendars/${entity.entity}?start=${start}Z&end=${end}Z`)
692694
try {
693695
return await (Promise.all(calendarUrlList.map(url =>
694-
this._hass.callApi('get', url))).then((result) => {
696+
this.hass.callApi('get', url))).then((result) => {
695697

696698
let ev = [].concat.apply([], (result.map((singleCalEvents, i) => {
697699
return singleCalEvents.map(evt => new EventClass(evt, this.config.entities[i]))
@@ -739,7 +741,7 @@ class AtomicCalendar extends LitElement {
739741

740742

741743
Promise.all(calendarUrlList.map(url =>
742-
this._hass.callApi('get', url[0]))).then((result, i) => {
744+
this.hass.callApi('get', url[0]))).then((result, i) => {
743745
if (monthToGet == this.monthToGet)
744746
result.map((eventsArray, i) => {
745747
this.month.map(m => {
@@ -838,7 +840,7 @@ class AtomicCalendar extends LitElement {
838840
return html`
839841
<div class="calTitle">
840842
<a href="https://calendar.google.com/calendar/r/month/${moment(this.selectedMonth).format('YYYY')}/${moment(this.selectedMonth).format('MM')}/1" style="text-decoration: none; color: ${this.config.titleColor}" target="_blank">
841-
${moment(this.selectedMonth).locale(this._hass.language).format('MMMM')} ${moment(this.selectedMonth).format('YYYY')}
843+
${moment(this.selectedMonth).locale(this.hass.language).format('MMMM')} ${moment(this.selectedMonth).format('YYYY')}
842844
</a>
843845
</div>
844846
<div class="calButtons">

atomic-calendar.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)