1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-03 07:08:01 +00:00

Add Advance The Date as a rails til

This commit is contained in:
jbranchaud
2016-08-31 09:11:39 -05:00
parent ea14c0beaa
commit 3e173b8d17
2 changed files with 19 additions and 1 deletions

17
rails/advance-the-date.md Normal file
View File

@@ -0,0 +1,17 @@
# Advance The Date
In Rails land, you can advance a date forward and backward with the
`#advance` method:
```ruby
> Date.today
=> Wed, 31 Aug 2016
> Date.today.advance(days: 1)
=> Thu, 01 Sep 2016
> Date.today.advance(months: 1)
=> Fri, 30 Sep 2016
> Date.today.advance(months: -2)
=> Thu, 30 Jun 2016
```
h/t Dillon Hafer