mirror of
https://gitee.com/elegant_wings/dbd-meeting-wx-small.git
synced 2025-06-21 14:19:38 +08:00
1
This commit is contained in:
parent
cba08d6f3f
commit
79d06953b0
@ -3,6 +3,8 @@ import {
|
||||
meetingRoomBookedRecordRq
|
||||
} from "../../../../api/meeting/meetingRoom.js"
|
||||
|
||||
import {selfFormatTimeReturnSecond59} from "../../../../utils/util.js"
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
@ -30,8 +32,9 @@ Page({
|
||||
// 选择-结束时间
|
||||
onInputEndTime(event) {
|
||||
let _this = this;
|
||||
|
||||
this.setData({
|
||||
endTime: _this.addSeconds(event.detail , 59),
|
||||
endTime: new Date(selfFormatTimeReturnSecond59(event.detail)).getTime(),
|
||||
});
|
||||
},
|
||||
|
||||
@ -81,11 +84,7 @@ Page({
|
||||
})
|
||||
},
|
||||
|
||||
// 添加指定秒数
|
||||
addSeconds(time , seconds) {
|
||||
return new Date(time.setSeconds(time.getSeconds() + seconds)).getTime();
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
|
@ -1,87 +1,102 @@
|
||||
//返回 例 2017
|
||||
const formatYear = data => {
|
||||
var date = data.date;
|
||||
var types = data.types;
|
||||
const year = date.getFullYear()
|
||||
const month = date.getMonth() + 1
|
||||
const day = date.getDate()
|
||||
const hour = date.getHours()
|
||||
const minute = date.getMinutes()
|
||||
const second = date.getSeconds()
|
||||
if (types == 'year') {
|
||||
return [year].map(formatNumber).join('-')
|
||||
} else if (types == 'month') {
|
||||
return [month].map(formatNumber).join('-')
|
||||
} else if (types == 'day') {
|
||||
return [day].map(formatNumber).join('-')
|
||||
}
|
||||
var date = data.date;
|
||||
var types = data.types;
|
||||
const year = date.getFullYear()
|
||||
const month = date.getMonth() + 1
|
||||
const day = date.getDate()
|
||||
const hour = date.getHours()
|
||||
const minute = date.getMinutes()
|
||||
const second = date.getSeconds()
|
||||
if (types == 'year') {
|
||||
return [year].map(formatNumber).join('-')
|
||||
} else if (types == 'month') {
|
||||
return [month].map(formatNumber).join('-')
|
||||
} else if (types == 'day') {
|
||||
return [day].map(formatNumber).join('-')
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//返回 例 12月02日
|
||||
const formatDate2 = date => {
|
||||
const month = date.getMonth() + 1
|
||||
const day = date.getDate()
|
||||
return [month].map(formatNumber) + '月' + [day].map(formatNumber) + '日'
|
||||
const month = date.getMonth() + 1
|
||||
const day = date.getDate()
|
||||
return [month].map(formatNumber) + '月' + [day].map(formatNumber) + '日'
|
||||
}
|
||||
|
||||
//返回 例 2017-12-12
|
||||
const formatDate = date => {
|
||||
const year = date.getFullYear()
|
||||
const month = date.getMonth() + 1
|
||||
const day = date.getDate()
|
||||
const hour = date.getHours()
|
||||
const minute = date.getMinutes()
|
||||
const second = date.getSeconds()
|
||||
return [year, month, day].map(formatNumber).join('-')
|
||||
const year = date.getFullYear()
|
||||
const month = date.getMonth() + 1
|
||||
const day = date.getDate()
|
||||
const hour = date.getHours()
|
||||
const minute = date.getMinutes()
|
||||
const second = date.getSeconds()
|
||||
return [year, month, day].map(formatNumber).join('-')
|
||||
}
|
||||
//返回 例 2017--12-12 12:30:00
|
||||
//返回 例 2017-12-12 12:30:00
|
||||
const formatTime = date => {
|
||||
const year = date.getFullYear()
|
||||
const month = date.getMonth() + 1
|
||||
const day = date.getDate()
|
||||
const hour = date.getHours()
|
||||
const minute = date.getMinutes()
|
||||
const second = date.getSeconds()
|
||||
const year = date.getFullYear()
|
||||
const month = date.getMonth() + 1
|
||||
const day = date.getDate()
|
||||
const hour = date.getHours()
|
||||
const minute = date.getMinutes()
|
||||
const second = date.getSeconds()
|
||||
|
||||
return [year, month, day].map(formatNumber).join('-') + ' ' + [hour, minute, second].map(formatNumber).join(':')
|
||||
return [year, month, day].map(formatNumber).join('-') + ' ' + [hour, minute, second].map(formatNumber).join(':')
|
||||
}
|
||||
//返回 例 12-12 12:30:00
|
||||
const formatTime2 = date => {
|
||||
const month = date.getMonth() + 1
|
||||
const day = date.getDate()
|
||||
const hour = date.getHours()
|
||||
const minute = date.getMinutes()
|
||||
const month = date.getMonth() + 1
|
||||
const day = date.getDate()
|
||||
const hour = date.getHours()
|
||||
const minute = date.getMinutes()
|
||||
|
||||
return [month, day].map(formatNumber).join('-') + ' ' + [hour, minute].map(formatNumber).join(':')
|
||||
return [month, day].map(formatNumber).join('-') + ' ' + [hour, minute].map(formatNumber).join(':')
|
||||
}
|
||||
//返回 小时12:00:00
|
||||
const formatHour = data => {
|
||||
var date = data.date;
|
||||
var types = data.types;
|
||||
const hour = date.getHours()
|
||||
const minute = date.getMinutes()
|
||||
const second = date.getSeconds()
|
||||
var date = data.date;
|
||||
var types = data.types;
|
||||
const hour = date.getHours()
|
||||
const minute = date.getMinutes()
|
||||
const second = date.getSeconds()
|
||||
|
||||
if (types == 'hour') {
|
||||
return [hour].map(formatNumber)
|
||||
} else if (types == 'minute') {
|
||||
return [minute].map(formatNumber).join('-')
|
||||
} else if (types == 'second') {
|
||||
return [second].map(formatNumber)
|
||||
}
|
||||
if (types == 'hour') {
|
||||
return [hour].map(formatNumber)
|
||||
} else if (types == 'minute') {
|
||||
return [minute].map(formatNumber).join('-')
|
||||
} else if (types == 'second') {
|
||||
return [second].map(formatNumber)
|
||||
}
|
||||
}
|
||||
|
||||
//返回 指定秒数59 , 2017-12-12 12:30:59
|
||||
function selfFormatTimeReturnSecond59(time) {
|
||||
let date = new Date(time);
|
||||
let year = date.getFullYear()
|
||||
let month = date.getMonth() + 1
|
||||
let day = date.getDate()
|
||||
let hour = date.getHours()
|
||||
let minute = date.getMinutes()
|
||||
let second = date.getSeconds()
|
||||
|
||||
return [year, month, day].map(formatNumber).join('-') + ' ' + [hour, minute, '59'].map(formatNumber).join(':')
|
||||
}
|
||||
|
||||
|
||||
const formatNumber = n => {
|
||||
n = n.toString()
|
||||
return n[1] ? n : '0' + n
|
||||
n = n.toString()
|
||||
return n[1] ? n : '0' + n
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
formatTime: formatTime,
|
||||
formatDate: formatDate,
|
||||
formatYear: formatYear,
|
||||
formatDate2: formatDate2,
|
||||
formatHour: formatHour,
|
||||
formatTime2: formatTime2
|
||||
}
|
||||
formatTime: formatTime,
|
||||
formatDate: formatDate,
|
||||
formatYear: formatYear,
|
||||
formatDate2: formatDate2,
|
||||
formatHour: formatHour,
|
||||
formatTime2: formatTime2,
|
||||
selfFormatTimeReturnSecond59
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user