how does vue query range with Moment array
https://stackoverflow.com/questions/14897571/moment-js-date-between-dates
https://momentjs.com/docs/#/query/
如果已经经过字符串格式化的时间,需要再次moment(timeString).isBetween(time1,time2)
而如果时间是通过key获取并没调用format则使用moment的format先进行格式化
实际例子:
return !moment((moment(item[key]).format('YYYY-MM-DD HH:mm:ss')))
.isBetween(rangeMoments[0].format('YYYY-MM-DD'), rangeMoments[1].format('YYYY-MM-DD 23:59:59'),
undefined, '[]')
由于有的时间组件只选择到天,但返回到要被between的时间参数是到秒到,
那么需要在延后就是endtime加如23:59:59来作为第二个区间参数。
官网例子:
Note that the order of the two arguments matter: the "smaller" date should be in the first argument.
moment('2016-10-30').isBetween('2016-10-30', '2016-12-30', undefined, '()'); //false
moment('2016-10-30').isBetween('2016-10-30', '2016-12-30', undefined, '[)'); //true
moment('2016-10-30').isBetween('2016-01-01', '2016-10-30', undefined, '()'); //false
moment('2016-10-30').isBetween('2016-01-01', '2016-10-30', undefined, '(]'); //true
moment('2016-10-30').isBetween('2016-10-30', '2016-10-30', undefined, '[]'); //true
标签:10,Vue,undefined,30,查询,isBetween,moment,momentjs,2016
From: https://www.cnblogs.com/ukzq/p/17056197.html