简体   繁体   English

将moment-range与sails后端连接起来

[英]Connect moment-range with sails backend

I want to get date range between start_time and end_time.我想获得 start_time 和 end_time 之间的日期范围。

 var newrange = sails.moment.range(start_time, end_time);

But it says,但它说,

 TypeError: sails.moment.range is not a function

Try setting up the imports like below and then run the function:尝试像下面这样设置导入,然后运行该函数:

const moment = require("moment");
const momentRange = require("moment-range");
momentRange.extendMoment(moment); 

var newrange = moment.range(start_time, end_time);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM