微信小程序日期格式化

< view class= "fl_form">
< picker mode= "date" value= "{{date}}" start= "{{date}}" end= "2020-01-01" bindchange= "bindDateChange">
< view class= "picker">
< text >选择日期 text > < text class= "chosedate">{{date}} text >
view >
picker >
view >
< view class= "fl_form newtime">
< picker mode= "time" value= "{{startime}}" start= "09:00" end= "21:00" bindchange= "starttime">
< view class= "picker">
< text >开始时间 text > < text class= "chosedate">{{starttime}} text >
view >
picker >
< picker mode= "time" value= "{{endtime}}" start= "09:00" end= "21:00" bindchange= "endtime">
< view class= "picker end">
< text >结束时间 text > < text class= "chosedate">{{endtime}} text >
view >
picker >
view >
< button class= "formbtn" bindtap= 'orderMeeting'>提交 button >

js代码:
var util = require( '../../utils/util.js') //引入微信自带的日期格式化
const app = getApp()
Page({
data: {
date:util.formatDate( new Date), //格式化日期
starttime: '9:00',
endtime: '21:00',
userName: ""
},
bindDateChange: function (e) {
this.setData({
date: e.detail.value
})
},
starttime: function (e) {
this.setData({
starttime: e.detail.value
})
},
endtime: function (e) {
this.setData({
endtime: e.detail.value
})
}
})

你可能感兴趣的:(微信小程序)