Date.tomorrow referencing two days from now

后端 未结 2 964
盖世英雄少女心
盖世英雄少女心 2021-01-21 02:28

I\'m seeing something very odd.

<%= (Date.today).strftime(\"%A, %B %d, %Y\") %>

is resulting in Wednesday, Octobe

相关标签:
2条回答
  • 2021-01-21 03:17

    Rails-Date has provided current method to compliment today method of Ruby-Date. So now you can use:

    Date.current     # Rails equivalent of Ruby's - Date.today
    Date.tomorrow
    

    for all dates which should be respecting Rails timezone and Ruby-Date.today keeps being what it is.

    0 讨论(0)
  • 2021-01-21 03:21

    The method tomorrow isn't in Ruby - only in Rails. Maybe your Ruby and your Rails are set for different timezones. What do you get from Date.current, which is basically today in rails?

    0 讨论(0)
提交回复
热议问题