Module: Gravitext::DateSupport

Defined in:
lib/gravitext-util/date_support.rb

Defined Under Namespace

Classes: JDate, TimeDelta

Constant Summary collapse

SEC_TO_MS =

One second in milliseconds

1_000
MIN_TO_MS =

One minute in milliseconds

60 * 1_000
HOUR_TO_MS =

One hour in milliseconds

60 * 60 * 1_000
DAY_TO_MS =

One day in milliseconds

24 * 60 * 60 * 1_000

Instance Method Summary collapse

Instance Method Details

#d_days(v) ⇒ Object

Return TimeDelta gioven Numeric days



53
54
55
# File 'lib/gravitext-util/date_support.rb', line 53

def d_days( v )
  TimeDelta.new(  DAY_TO_MS * v )
end

#d_hours(v) ⇒ Object

Return TimeDelta gioven Numeric hours



48
49
50
# File 'lib/gravitext-util/date_support.rb', line 48

def d_hours( v )
  TimeDelta.new( HOUR_TO_MS * v )
end

#d_mins(v) ⇒ Object

Return TimeDelta given Numeric minutes



43
44
45
# File 'lib/gravitext-util/date_support.rb', line 43

def d_mins( v )
  TimeDelta.new( MIN_TO_MS * v )
end

#d_secs(v) ⇒ Object

Return TimeDelta given Numeric seconds



38
39
40
# File 'lib/gravitext-util/date_support.rb', line 38

def d_secs( v )
  TimeDelta.new( SEC_TO_MS * v )
end