有没有知道一个主要的JavaScript框架的好日历(不是datepicker,但是一个BIG可浏览的日历)插件.我更喜欢jQuery.
我试图在textarea中显示rails视图文件.视图文件包含一堆HTML,我想要转义它,以便它不会干扰页面html.这是一个例子:
In this view we are going to display the contents of a partial
<textarea>
<%= html_escape render('partial') %>
</textarea>
Run Code Online (Sandbox Code Playgroud)
在partial.html.erb我会
Hello this is partial.html.erb and this is a
<textarea>textarea</textarea> blah blah blah.
Run Code Online (Sandbox Code Playgroud)
问题是:partial.html中的textarea在第一个视图中打破了textarea,因为它不是html_escaped.如何在属性中转义并显示textarea内部分的内容?
所以,我有一串时间......有些事情
'4 hours'
'48 hours'
'3 days'
'15 minutes'
Run Code Online (Sandbox Code Playgroud)
我想将这些转换为秒.因为'4 hours',这很好
Time.parse('4 hours').to_i - Time.parse('0 hours').to_i
=> 14400 # 4 hours in seconds, yay
Run Code Online (Sandbox Code Playgroud)
但是,这在48小时内不起作用(超出范围误差).它也不工作3天(没有信息错误)等.
有没有一种简单的方法将这些字符串转换为秒?