@@ -114,10 +114,12 @@ function buildCalendar(config: atomicCardConfig, selectedMonth) {
114114export async function getEventMode ( config : atomicCardConfig , hass ) {
115115
116116 const daysToShow = config . maxDaysToShow ! == 0 ? config . maxDaysToShow ! : config . maxDaysToShow ! - 1 ;
117- const today = dayjs ( ) . startOf ( 'day' ) ;
117+ const today = dayjs ( ) ;
118118 const start = today
119+ . startOf ( 'day' )
119120 . add ( config . startDaysAhead ! , 'day' ) ;
120121 const end = today
122+ . endOf ( 'day' )
121123 . add ( daysToShow + config . startDaysAhead ! , 'day' ) ;
122124 const getEvents = await getAllEvents ( start , end , config , hass ) ;
123125 return getEvents ;
@@ -154,14 +156,16 @@ export async function getCalendarMode(config: atomicCardConfig, hass, selectedMo
154156export async function getAllEvents ( start : dayjs . Dayjs , end : dayjs . Dayjs , config : atomicCardConfig , hass ) {
155157
156158 // format times correctly
157- const today = dayjs ( ) . startOf ( 'day' ) ;
159+ const today = dayjs ( ) ;
158160 const dateFormat = 'YYYY-MM-DDTHH:mm:ss' ;
159161 const timeOffset = - dayjs ( ) . utcOffset ( ) ;
160162
161163 const startTime = start
164+ . startOf ( 'day' )
162165 . add ( timeOffset , 'minutes' )
163166 . format ( dateFormat ) ;
164167 const endTime = end
168+ . endOf ( 'day' )
165169 . add ( timeOffset , 'minutes' )
166170 . format ( dateFormat ) ;
167171
@@ -176,7 +180,7 @@ export async function getAllEvents(start: dayjs.Dayjs, end: dayjs.Dayjs, config:
176180 const calendarEntity = ( entity && entity . entity ) || entity ;
177181
178182 // get correct end date if maxDaysToShow is set
179- const entityEnd = typeof entity . maxDaysToShow != 'undefined' ? today
183+ const entityEnd = typeof entity . maxDaysToShow != 'undefined' ? today . endOf ( 'day' )
180184 . add ( entity . maxDaysToShow ! - 1 + config . startDaysAhead ! , 'day' )
181185 . add ( timeOffset , 'minutes' ) . format ( dateFormat ) : endTime ;
182186
0 commit comments