0

Looking for a library/class/function/etc that will process various time syntaxes ("1:30", "1h30m", etc) into seconds/datetime/something.

I'm looking for users to string input length of time data should be valid for.

Essentially the opposite of momentjs's humanize: http://momentjs.com/docs/#/durations/humanize/

4

1 に答える 1

0

これにはその機能の一部があります。基本的な機能ですが、小さくて使いやすいです。

https://github.com/dpweb/time-ago/blob/master/README.md#tatimefriendlyx-period

var ta = require('./time-ago.js');  // node.js
var ta = timeago();                 // browser

ta.timefriendly('1 hour')  // convert to ms: seconds, minutes, hours, days, weeks, months, years 
 ==> 3600000
于 2013-09-07T02:03:59.203 に答える