开发者

Chronic for Javascript?

开发者 https://www.devze.com 2023-03-04 12:09 出处:网络
I\'m looking for something like the Ruby Chronic library, but for Javascript. The main things I need to be able to do is parse natural time entry, not dates. For example:

I'm looking for something like the Ruby Chronic library, but for Javascript. The main things I need to be able to do is parse natural time entry, not dates. For example:

Typing   Would Give
------   ----------
8a       08:00
8:30p    20:30
8:01开发者_开发知识库 AM  08:01
21:22    21:22
noon     12:00
midnight 00:00

I could write it myself, but before I go off and tackle it, I wanted to know if there was something already available.

I'm using jQuery already, so if there's a plugin, that would be hoopy too.

Thanks!


In place of my previous answer recommending Date.js, I'd like to update my answer by recommending Moment.js instead. It's a stable project that is still under active development. In addition, it is far more feature-filled and has a superior API. :)


Date.JS is a wonderful JS library for working with dates and times.


Comparison support for Ruby Chronic.com date and time input formats.

Check this out http://www.datejs.com/test/ruby_chronic/index.html

0

精彩评论

暂无评论...
验证码 换一张
取 消