Skip to content

Commit

Permalink
Fix a few typos in DOs/DON'Ts comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicklas Ramhöj committed Aug 27, 2015
1 parent 53bbaa9 commit 8d25760
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
20 changes: 10 additions & 10 deletions README.md
Expand Up @@ -86,20 +86,20 @@ There is [Zonebie](https://github.com/alindeman/zonebie), a gem that helps you d

### DOs

2.hours.ago # => Thu, 27 Aug 2015 14:20:13 AFT +04:30
1.day.from_now # => Fri, 28 Aug 2015 16:20:13 AFT +04:30
Time.zone.parse("2015-08-27T11:50:13Z") # => Thu, 27 Aug 2015 16:20:13 AFT +04:30
Time.current # => Thu, 27 Aug 2015 16:20:13 AFT +04:30
Time.current.utc.iso8601 # When supliyng an API (you can actually skip .zone here, but I find it better to always use it, than miss it when it's needed ("2015-08-27T11:50:13Z")
Time.strptime("2015-08-27T11:50:13Z", "%Y-%m-%dT%H:%M:%S%z").in_time_zone # If you can't use time.zone.parse (Thu, 27 Aug 2015 16:20:13 AFT +04:30)
Date.current # Tue, 18 Aug 2015 If you really can't have a Time or DateTime for some reason (Thu, 27 Aug 2015)
2.hours.ago # => Thu, 27 Aug 2015 14:39:36 AFT +04:30
1.day.from_now # => Fri, 28 Aug 2015 16:39:36 AFT +04:30
Time.zone.parse("2015-08-27T12:09:36Z") # => Thu, 27 Aug 2015 16:39:36 AFT +04:30
Time.current # => Thu, 27 Aug 2015 16:39:36 AFT +04:30
Time.current.utc.iso8601 # When supliyng an API ("2015-08-27T12:09:36Z")
Time.strptime("2015-08-27T12:09:36Z", "%Y-%m-%dT%H:%M:%S%z").in_time_zone # If you can't use Time.zone.parse (Thu, 27 Aug 2015 16:39:36 AFT +04:30)
Date.current # If you really can't have a Time or DateTime for some reason (Thu, 27 Aug 2015)
Date.current.in_time_zone # If you have a date and want to make the best out of it (Thu, 27 Aug 2015 00:00:00 AFT +04:30)

### DON'Ts

Time.now # Returns system time and ignores your configured time zone. (2015-08-27 13:50:13 +0200)
Time.parse("2015-08-27T11:50:13Z") # Will assume time string given is in the system's time zone. (2015-08-27 11:50:13 UTC)
Time.strptime("2015-08-27T11:50:13Z", "%Y-%m-%dT%H:%M:%S%z") # Same problem as with Time#parse. (2015-08-27 11:50:13 UTC)
Time.now # Returns system time and ignores your configured time zone. (2015-08-27 14:09:36 +0200)
Time.parse("2015-08-27T12:09:36Z") # Will assume time string given is in the system's time zone. (2015-08-27 12:09:36 UTC)
Time.strptime("2015-08-27T12:09:36Z", "%Y-%m-%dT%H:%M:%S%z") # Same problem as with Time.parse. (2015-08-27 12:09:36 UTC)
Date.today # This could be yesterday or tomorrow depending on the machine's time zone, see https://github.com/ramhoj/time-zone-article/issues/1 for more info. (Thu, 27 Aug 2015)

## Epilogue
Expand Down
8 changes: 4 additions & 4 deletions script/update_dosdonts.rb
Expand Up @@ -8,15 +8,15 @@
['1.day.from_now'],
[%Q{Time.zone.parse("#{iso_string}")}],
['Time.current'],
['Time.current.utc.iso8601', "When supliyng an API (you can actually skip .zone here, but I find it better to always use it, than miss it when it's needed"],
[%Q{Time.strptime("#{iso_string}", "%Y-%m-%dT%H:%M:%S%z").in_time_zone}, "If you can't use time.zone.parse"],
['Date.current', "Tue, 18 Aug 2015 If you really can't have a Time or DateTime for some reason"],
['Time.current.utc.iso8601', "When supliyng an API"],
[%Q{Time.strptime("#{iso_string}", "%Y-%m-%dT%H:%M:%S%z").in_time_zone}, "If you can't use Time.zone.parse"],
['Date.current', "If you really can't have a Time or DateTime for some reason"],
['Date.current.in_time_zone', "If you have a date and want to make the best out of it"]
],
[
['Time.now', "Returns system time and ignores your configured time zone."],
[%Q{Time.parse("#{iso_string}")}, "Will assume time string given is in the system's time zone."],
[%Q{Time.strptime("#{iso_string}", "%Y-%m-%dT%H:%M:%S%z")}, "Same problem as with Time#parse."],
[%Q{Time.strptime("#{iso_string}", "%Y-%m-%dT%H:%M:%S%z")}, "Same problem as with Time.parse."],
['Date.today', "This could be yesterday or tomorrow depending on the machine's time zone, see https://github.com/ramhoj/time-zone-article/issues/1 for more info."]
]
].each_with_index do |list, index|
Expand Down

0 comments on commit 8d25760

Please sign in to comment.