diff --git a/src/components/Discover/Map/Filter/Timeframes.vue b/src/components/Discover/Map/Filter/Timeframes.vue index 98a0515..fd22d27 100644 --- a/src/components/Discover/Map/Filter/Timeframes.vue +++ b/src/components/Discover/Map/Filter/Timeframes.vue @@ -132,8 +132,8 @@ export default{ watch:{ selectTimeFrame(newValue, oldValue) { if(newValue.length === 0) { - this.startTime = new Date(getMoment(this.filterTimeframe.x_axis.min).format()); - this.endTime = new Date(getMoment(this.filterTimeframe.x_axis.max).format()); + this.startTime = new Date(this.filterTimeframe.x_axis.min); + this.endTime = new Date(this.filterTimeframe.x_axis.max); this.selectArea = [0, this.selectRange]; this.resizeMask(this.chart); } @@ -300,10 +300,10 @@ export default{ // Slider this.selectArea = [0, this.selectRange]; // Calendar - this.startMinDate = new Date(getMoment(this.filterTimeframe.x_axis.min).format()); - this.startMaxDate = new Date(getMoment(this.filterTimeframe.x_axis.max).format()); - this.endMinDate = new Date(getMoment(this.filterTimeframe.x_axis.min).format()); - this.endMaxDate = new Date(getMoment(this.filterTimeframe.x_axis.max).format()); + this.startMinDate = new Date(this.filterTimeframe.x_axis.min); + this.startMaxDate = new Date(this.filterTimeframe.x_axis.max); + this.endMinDate = new Date(this.filterTimeframe.x_axis.min); + this.endMaxDate = new Date(this.filterTimeframe.x_axis.max); // 讓日曆的範圍等於時間軸的範圍 this.startTime = this.startMinDate; this.endTime = this.startMaxDate; diff --git a/src/components/Discover/Map/SidebarFilter.vue b/src/components/Discover/Map/SidebarFilter.vue index e335953..e5f4cd4 100644 --- a/src/components/Discover/Map/SidebarFilter.vue +++ b/src/components/Discover/Map/SidebarFilter.vue @@ -460,15 +460,18 @@ export default { break; case 'int-attr': case 'float-attr': + label = `${includeStr}, ${e.key}, from ${e.min} to ${e.max}`; + type = "Attributes"; + break; case 'date-attr': - label = `${includeStr}, ${e.key}, start with ${e.min}, end with ${e.max}`; + label = `${includeStr}, ${e.key}, from ${getMoment(e.min).format('YYYY-MM-DD HH:mm')} to ${getMoment(e.max).format('YYYY-MM-DD HH:mm')}`; type = "Attributes"; break; case "occurred-in": case "started-in": case "completed-in": case "occurred-around": - label = `${containmentMap[e.type]}, ${includeStr}, from ${getMoment(e.start).format("YYYY-MM-DD HH:mm:ss")} to ${getMoment(e.end).format("YYYY-MM-DD HH:mm:ss")} ` + label = `${containmentMap[e.type]}, ${includeStr}, from ${getMoment(e.start).format("YYYY-MM-DD HH:mm")} to ${getMoment(e.end).format("YYYY-MM-DD HH:mm")} ` type = "Timeframe" break; }; diff --git a/src/stores/allMapData.js b/src/stores/allMapData.js index cdb036c..f77ea72 100644 --- a/src/stores/allMapData.js +++ b/src/stores/allMapData.js @@ -241,21 +241,11 @@ export default defineStore('allMapDataStore', { this.allFilterTimeframe = response.data.timeframe; this.allFilterTrace = response.data.trace; this.allFilterAttrs = response.data.attrs; - // this.allFilterAttrs.map(att => { - // switch (att.type) { - // case 'date': - // att.min = att.min !== null ? moment(att.min).format('YYYY/MM/DD HH:mm:ss') : null; - // att.max = att.max !== null ? moment(att.max).format('YYYY/MM/DD HH:mm:ss') : null; - // break; - // case 'float': - // att.min = att.min !== null ? new Decimal(att.min).toFixed(2) : null; - // att.max = att.max !== null ? new Decimal(att.max).toFixed(2) : null; - // break - // default: - // break; - // } - // return att; - // }); + + let min = this.allFilterTimeframe.x_axis.min; + let max = this.allFilterTimeframe.x_axis.max; + this.allFilterTimeframe.x_axis.min = min !== null ? moment(min).format('YYYY/MM/DD HH:mm') : null; + this.allFilterTimeframe.x_axis.max = max !== null ? moment(max).format('YYYY/MM/DD HH:mm') : null; } catch(error) { apiError(error, 'Failed to load the Filter Parameters.'); };