Skip to content

Commit

Permalink
chore: just add an extra case clause for zone handling of local and utc
Browse files Browse the repository at this point in the history
  • Loading branch information
adzap committed Dec 1, 2024
1 parent d06c09b commit 0e6a120
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/timeliness/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,10 @@ def current_date(options)

def current_time_in_zone(zone)
case zone
when :utc, :local
Time.now.send("get#{zone}")
when :utc
Time.now.getutc
when :local
Time.now.getlocal
when :current
Time.current
else
Expand All @@ -110,8 +112,10 @@ def current_time_in_zone(zone)
def shift_time_to_zone(time, zone=nil)
zone ||= Timeliness.configuration.default_timezone
case zone
when :utc, :local
time.send("get#{zone}")
when :utc
time.getutc
when :local
time.getlocal
when :current
time.in_time_zone
else
Expand Down

0 comments on commit 0e6a120

Please sign in to comment.