小编vad*_*sov的帖子

Moment.js转换为日期对象

使用Moment.js我无法将正确的时刻对象转换为带时区的日期对象.我无法得到正确的日期.

例:

var oldDate = new Date(),
    momentObj = moment(oldDate).tz("MST7MDT"),
    newDate = momentObj.toDate();
console.log("start date " + oldDate)
console.log("Format from moment with offset " + momentObj.format())
console.log("Format from moment without offset " + momentObj.utc().format())
console.log("(Date object) Time with offset " + newDate)
console.log("(Date object) Time without offset "+ moment.utc(newDate).toDate())
Run Code Online (Sandbox Code Playgroud)

javascript momentjs

619
推荐指数
7
解决办法
54万
查看次数

使用requirejs模块作为es6模块

我正在尝试将我的项目迁移到ES6模块,但我遇到了一个问题.

我有第三方脚本,在requirejs的帮助下使用模块.我们将其命名为3rdParty.js.它是通过凉亭获得的,因此没有能力并希望更新它.

有没有办法导入3rdParty.js,使用ES6语法而不从文件中删除定义函数?

javascript commonjs requirejs ecmascript-6 es6-module-loader

2
推荐指数
1
解决办法
2557
查看次数