@@ -157,7 +157,6 @@ import Visits from 'collections/visits'
157157import Beamlines from ' collections/bls'
158158import FilterPills from ' app/components/filter-pills.vue'
159159import CalendarDayEvents from ' modules/calendar/views/components/calendar-day-events.vue'
160- import { DateTime } from ' luxon'
161160
162161export default {
163162 name: ' CalendarView' ,
@@ -220,9 +219,9 @@ export default {
220219 },
221220 mounted () {
222221 const dateTime = this .todayDate
223- this .currentMonth = dateTime .month - 1
224- this .currentDay = dateTime .day
225- this .currentYear = dateTime .year
222+ this .currentMonth = dateTime .getMonth ()
223+ this .currentDay = dateTime .getDate ()
224+ this .currentYear = dateTime .getFullYear ()
226225 this .fetchBeamlinesByType ()
227226 this .fetchVisitsCalendar ()
228227 },
@@ -330,19 +329,16 @@ export default {
330329 }, {})
331330 },
332331 isToday (date ) {
333- const { month , day , year } = this .todayDate
334- return date === day && month - 1 === this .currentMonth && year === this .currentYear
332+ const today = this .todayDate
333+ return (
334+ date === today .getDate () &&
335+ this .currentMonth === today .getMonth () &&
336+ this .currentYear === today .getFullYear ()
337+ )
335338 },
336339 isPastDate (date ) {
337- const dateItem = DateTime .fromObject ({
338- year: this .currentYear ,
339- month: this .currentMonth + 1 ,
340- day: date,
341- zone: this .timezone
342- })
343-
340+ const dateItem = new Date (this .currentYear , this .currentMonth , date);
344341 return dateItem < this .todayDate
345-
346342 },
347343 onHover (ref , addHover ) {
348344 const hoveredRef = this .$refs [ref][0 ].$el
@@ -409,7 +405,9 @@ export default {
409405 return this .appOption [' timezone' ]
410406 },
411407 todayDate () {
412- return DateTime .local ().setZone (this .timezone )
408+ const d = new Date ()
409+ d .setHours (0 , 0 , 0 , 0 )
410+ return d
413411 },
414412 currentSelectedMonth () {
415413 return this .months [this .currentMonth ]
@@ -439,20 +437,12 @@ export default {
439437 return this .currentYear + 1
440438 },
441439 daysInMonth () {
442- return DateTime .fromObject ({
443- year: this .currentYear ,
444- month: this .currentMonth + 1 ,
445- day: 1 ,
446- zone: this .timezone
447- }).daysInMonth
440+ return new Date (this .currentYear , this .currentMonth + 1 , 0 ).getDate ()
448441 },
449442 startDayOfMonth () {
450- return DateTime .fromObject ({
451- year: this .currentYear ,
452- month: this .currentMonth + 1 ,
453- day: 1 ,
454- zone: this .timezone
455- }).weekday - 1
443+ const dateItem = new Date (this .currentYear , this .currentMonth , 1 )
444+ const day = dateItem .getDay ()
445+ return (day === 0 ) ? 6 : day - 1
456446 },
457447 sortedVisitsByDay () {
458448 return Array (this .daysInMonth ).fill (' ' ).reduce ((acc , curr , index ) => {
0 commit comments