时间格式修改

This commit is contained in:
wuhongjian 2022-08-02 14:35:16 +08:00
parent b47614a94f
commit 71227bf0a9
3 changed files with 12 additions and 7 deletions

View File

@ -132,12 +132,13 @@ export default {
const currentDate = new Date();
currentDate.setTime(currentDate.getTime());
currentDate.setTime(currentDate.getTime() - 24 * 60 * 60 * 1000);
const yDate = currentDate.getDate() > 9 ? currentDate.getDate(): '0' + currentDate.getDate()
this.preTime =
currentDate.getFullYear() +
"-" +
((currentDate.getMonth() + 1) > 10 ? (currentDate.getMonth() + 1) : "0" + (currentDate.getMonth() + 1)) +
"-" +
currentDate.getDate() +
yDate +
" " +
"00:00:00";
},

View File

@ -2,7 +2,7 @@
* @Author: hisense.wuhongjian
* @Date: 2022-03-08 14:10:05
* @LastEditors: hisense.wuhongjian
* @LastEditTime: 2022-05-12 18:24:51
* @LastEditTime: 2022-08-02 14:31:25
* @Description: 道路治理专题
-->
<!-- -->
@ -243,11 +243,12 @@ export default {
const currentDate = new Date();
currentDate.setTime(currentDate.getTime());
this.monthTime = currentDate.getFullYear() + "-" + ((currentDate.getMonth() + 1) > 10 ? (currentDate.getMonth() + 1) : "0" + (currentDate.getMonth() + 1)) + "-" + "01" + " " + "00:00:00";
this.currentTime = currentDate.getFullYear() + "-" + ((currentDate.getMonth() + 1) > 10 ? (currentDate.getMonth() + 1) : "0" + (currentDate.getMonth() + 1)) + "-" + currentDate.getDate() + " " + "00:00:00";
this.currentTime = currentDate.getFullYear() + "-" + ((currentDate.getMonth() + 1) > 10 ? (currentDate.getMonth() + 1) : "0" + (currentDate.getMonth() + 1)) + "-" + yDate + " " + "00:00:00";
currentDate.setTime(currentDate.getTime() - 24 * 60 * 60 * 1000);
this.preTime =currentDate.getFullYear() +"-" + ((currentDate.getMonth() + 1) > 10 ? (currentDate.getMonth() + 1) : "0" + (currentDate.getMonth() + 1)) + "-" + currentDate.getDate() + " " +"00:00:00";
const yDate = currentDate.getDate() > 9 ? currentDate.getDate(): '0' + currentDate.getDate()
this.preTime =currentDate.getFullYear() +"-" + ((currentDate.getMonth() + 1) > 10 ? (currentDate.getMonth() + 1) : "0" + (currentDate.getMonth() + 1)) + "-" + yDate + " " +"00:00:00";
currentDate.setDate(currentDate.getDate() - currentDate.getDay() + 1);
this.weekTime =currentDate.getFullYear() + "-" + ((currentDate.getMonth() + 1) > 10 ? (currentDate.getMonth() + 1) : "0" + (currentDate.getMonth() + 1)) + "-" + currentDate.getDate() + " " + "00:00:00";
this.weekTime =currentDate.getFullYear() + "-" + ((currentDate.getMonth() + 1) > 10 ? (currentDate.getMonth() + 1) : "0" + (currentDate.getMonth() + 1)) + "-" + yDate + " " + "00:00:00";
},
// - 访DOM
mounted() {

View File

@ -58,6 +58,7 @@
</div>
</template>
<script>
import dayjs from 'dayjs'
import { selectRaise, getAndSaveRecords, selectNoiceEvent } from '@/api/construction/index'
import { selectWaterPoint,selectWaterCamera,selectReportOrigin } from '@/api/waterPoints'
import StatisticalAnalysis from './StatisticalAnalysis.vue'
@ -129,12 +130,14 @@ export default {
const currentDate = new Date()
currentDate.setTime(currentDate.getTime())
currentDate.setTime(currentDate.getTime() - 24 * 60 * 60 * 1000)
const yMonth = currentDate.getMonth() > 8 ? currentDate.getMonth() + 1: '0' + (currentDate.getMonth()+1)
const yDate = currentDate.getDate() > 9 ? currentDate.getDate(): '0' + currentDate.getDate()
this.preTime =
currentDate.getFullYear() +
'-' +
(currentDate.getMonth() + 1) +
yMonth +
'-' +
currentDate.getDate() +
yDate +
' ' +
'00:00:00'
},