parseformat


npm install moment-parseformat

该插件提取日期/时间字符串的格式。

var format = moment.parseFormat('Thursday, February 6th, 2014 9:20pm');
// dddd, MMMM Do, YYYY h:mma
moment().format(format); // 格式化

这样就可以创建智能日期输入,让用户设置日期/时间,并提取用户的首选格式以供将来使用。 在 minutes.io 上找到其用法示例。

该插件由 @gr2m 编写。 链接:演示 | 源代码

npm install moment-parseformat

This plugin extracts the format of a date/time string.

var format = moment.parseFormat('Thursday, February 6th, 2014 9:20pm');
// dddd, MMMM Do, YYYY h:mma
moment().format(format); // format

That allows to create smart date inputs that let your users set a Date/Time and lets you extract the user's preferred format for future usage. Find an example usage of it at minutes.io.

The Plugin has been authored by @gr2m. Links: Demo | Source