Class: DateTime::NoLeap

Inherits:
DateTimeLike show all
Extended by:
DateTimeLikeExtension
Defined in:
lib/timesteps/datetime_noleap.rb,
lib/timesteps/datetime_timestep.rb

Overview

datetime class represents ‘noleap` or `365_day` calendar

Constant Summary collapse

DPY =

Number of days per year

365
DPM =

Numbers of days per months

[0,31,28,31,30,31,30,31,31,30,31,30,31]
UNIX_EPOCH_IN_AJD =

Astronomical Julian day number of UNIX epoch

Rational(4877859,2)

Instance Attribute Summary

Attributes inherited from DateTimeLike

#day, #hour, #minute, #month, #offset, #year

Instance Method Summary collapse

Methods inherited from DateTimeLike

#+, #-, #<<, #<=>, #>>, #ajd, #compare_d, #compare_md, #difference_in_months, #difference_in_years, #fraction, #initialize, #inspect, #jd, #new_offset, #next_day, #next_month, #next_year, #prev_day, #prev_month, #prev_year, #second, #second_fraction, #succ, #to_s, #wday, #yday

Constructor Details

This class inherits a constructor from DateTimeLike

Instance Method Details

#leap?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/timesteps/datetime_noleap.rb', line 33

def leap?
  false
end

#strftime(spec) ⇒ Object



29
30
31
# File 'lib/timesteps/datetime_noleap.rb', line 29

def strftime (spec)
  DateTime.new(@year, @month, @day, @hour, @minute, @second, @offset).strftime(spec)
end

#timeperiod(interval_spec, tz: nil, ends: "[]") ⇒ Object



64
65
66
# File 'lib/timesteps/datetime_timestep.rb', line 64

def timeperiod (interval_spec, tz: nil, ends: "[]")
  return TimePeriod.new(interval_spec, since: self, calendar: "noleap", ends: ends, tz: tz)
end

#timestep(interval_spec, tz: nil) ⇒ Object



60
61
62
# File 'lib/timesteps/datetime_timestep.rb', line 60

def timestep (interval_spec, tz: nil)
  return TimeStep.new(interval_spec, since: self, clanedar: "noleap", tz: tz)
end