开发者

datejs vs Jquery/globalize

开发者 https://www.devze.com 2023-03-27 02:35 出处:网络
Could someone list the pros and cons of using one over the other. (www.datejs.com vs. https://github.com/jquery/globalize). All I knew is Jquery/globalize supports more cu开发者_StackOverflow社区lture

Could someone list the pros and cons of using one over the other. (www.datejs.com vs. https://github.com/jquery/globalize). All I knew is Jquery/globalize supports more cu开发者_StackOverflow社区lture than datejs.


You can use both of them together. DateJS makes it much more convenient to do math on date objects, and also provides some functionality for displaying dates. Globalize provides functionality for displaying dates for different cultures.

  • If you need to do math on dates and to display internationalized dates, use both. Have Globalize display dates that are calculated with DateJS.
  • If you just need to do math on dates and display dates in a format readable by most Internet users, use DateJS.
  • If you don't need to do math on dates (it might be that the server and APIs take care of it), but need to display internationalized dates, use Globalize.


Globalize supports more than just Date/Time formatting and Parsing (different Calendar systems with automatic conversion in the related field, number, currency, percentage formatting, translating strings, checking if given language is written Right-To-Left). It is fairly well-written and supports more than 350 culture. The project is quite active.

DateJS supports less cultures and only Date/Time formatting, parsing and manipulating as well as time zones conversion (unsupported by Globalize). The project is less active and the last snapshot is rather old (and marked as Alpha version). It seems like Joda Time equivalent for JavaScript and it really seems nice, but...
Fortunately, as Ben said you can combine them together.

0

精彩评论

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

关注公众号