我想像下面的代码一样验证 DateTime
{
"data": {
"start": "2018-05-12 08:00:00"
}
}
Run Code Online (Sandbox Code Playgroud)
如何结合 isISO8601() 和 match(regex) 在开始时验证日期和时间
body('*.start')
.exists()
.not()
.isEmpty()
.withMessage('start cannot be empty')
.isISO8601('yyyy-mm-dd')
.matches('^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$')
.withMessage('start must be in correct format yyyy:mm:dd hh:mm:ss'),
Run Code Online (Sandbox Code Playgroud)