diff --git a/SAS/TMSS/frontend/tmss_webapp/src/components/Timeline/CalendarTimeline.js b/SAS/TMSS/frontend/tmss_webapp/src/components/Timeline/CalendarTimeline.js index afa4c15438c43da28c19c1ad6ba24e4336cec154..078474eb8255269107ab988797822229199f52bb 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/components/Timeline/CalendarTimeline.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/components/Timeline/CalendarTimeline.js @@ -184,6 +184,10 @@ export class CalendarTimeline extends Component { // Update UTC clock every second to keep the clock display live this.updateClock = setInterval(function(){setCurrentUTC()}, 1000); if (this.state.viewType === UIConstants.timeline.types.WEEKVIEW) { + const showCustomDate = localStorage.getItem('showCustomDate'); + if (showCustomDate === 'true') { + this.setState({showCustomDate: true}); + } this.addWeekSunTimes(defaultStartTime, defaultEndTime, this.state.group, this.state.items) .then(items => { // Set the current display date as the weekDay @@ -952,11 +956,11 @@ export class CalendarTimeline extends Component { } const result = await this.props.dateRangeCallback(startTime, endTime, refreshData, weekDay); if (!this.props.showSunTimings && this.state.viewType === UIConstants.timeline.types.NORMAL && !this.loadingStationSunTimes) { - result.items = this.showCustomDate ? result.items : await this.addStationSunTimes(startTime, endTime, result.group, result.items); + result.items = await this.addStationSunTimes(startTime, endTime, result.group, result.items); result.items = _.orderBy(result.items, ['type'], ['desc']); } else if (this.state.viewType === UIConstants.timeline.types.WEEKVIEW && !this.loadingWeekSunTimes) { let group = DEFAULT_GROUP.concat(result.group); - result.items = this.showCustomDate ? result.items : await this.addWeekSunTimes(startTime, endTime, group, result.items); + result.items = this.state.showCustomDate?result.items:await this.addWeekSunTimes(startTime, endTime, group, result.items); } return result; } @@ -1188,8 +1192,7 @@ export class CalendarTimeline extends Component { /** * Resets the timeline view to default zoom and move to the current timeline */ - async resetToCurrentTime(){ - await this.setState({showCustomDate: false, reset: true}); + async resetToCurrentTime(){ if (this.state.viewType===UIConstants.timeline.types.NORMAL) { const startTime = moment().utc().add(-24, 'hours'); const endTime = moment().utc().add(24, 'hours'); @@ -1205,6 +1208,7 @@ export class CalendarTimeline extends Component { delete this.timelineUIAttributes["zoomLevel"]; this.timelineCommonUtils.storeUIAttributes(this.timelineUIAttributes); } else { + await this.setState({showCustomDate: false, reset: true}); const weekDay = moment.utc(moment(this.state.weekDay[0]).format(UTC_DATE_FORMAT)); if (moment().utc().week()-this.state.timelineStartDate.week() !== 0 || moment().utc().diff(weekDay, 'day') !== 0) { await this.setState({weekDay: [moment().utc().format(UTC_DATE_FORMAT)]});