Ruby on Rails : differs from Date.current

Date.current also returns if timeZone is not set other wise returns Today's Date of current time zone. We can verify this by changing the timezone.

If your doing comparisons you should always use Date.current

This is because if you’re in a timezone that could be in a different day than UTC, and your timezone isn’t set then you can have the situation where == Date.tomorrow

So it would be more preferable

<% if advert.deadline < Date.current %>    

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s