Strftime 未更新到正确的日期
我有一个 sinatra 应用程序,其中有一条小消息,我想说“快乐的“DayOfWeek””,但是我注意到它没有显示页面的正确日期,而是打印了前一个日期。 代码非常简单:
<%= "Happy #{Time.now.strftime("%A")}" %>
我以为这与请求响应周期有关,但是我切换了浏览器,在 chrome、firefox 和 safari 中都遇到了同样的问题。有人知道发生了什么事吗?
I have a sinatra app that has a small message that I want to say Happy "DayOfWeek" however I am noticing that it doesn't display the correct day for the page, it prints the previous one.
The code is extremely simple:
<%= "Happy #{Time.now.strftime("%A")}" %>
I thought it had something to do with the request response cycle, but I switched browsers and I got the same issue in chrome, firefox, and safari. Anyone have an idea of what is going on?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
摘自演示文稿的幻灯片 #28 Sinatra:最经典的原型 ,作者 Bryce Kerley,您会看到以下内容:
应该可以做到。
from slide #28 of the presentation Sinatra: The Classiest of Prototypes, by Bryce Kerley, you see the following:
that should do it.