Class: Date

Inherits:
Object
  • Object
show all
Defined in:
lib/englishnepalidateconverter/extensions/date.rb

Overview

Extension to Ruby’s Date class to add Bikram Sambat conversion methods

Instance Method Summary collapse

Instance Method Details

#to_bsObject



12
13
14
15
16
17
18
19
# File 'lib/englishnepalidateconverter/extensions/date.rb', line 12

def to_bs
  if self < EPOCH_AD_START || self > EPOCH_AD_END
    raise DateOutOfRangeError,
          "Date #{self} is out of supported AD Range (1943-04-14 - 2034-04-13)"
  end

  BSDate.from_ad(self)
end