Module: PositiveTimeSupport::DateExt

Defined in:
lib/positive_time_support/date_ext.rb

Overview

日付を扱うクラス Date に機能を追加するモジュール

Constant Summary collapse

WDAYS_JA_SHORT =
[ "日" , "月" , "火" , "水" , "木" , "金" , "土" ]

Instance Method Summary collapse

Instance Method Details

#holiday?Boolean

(日本の)祝日か否かを判定するメソッド

Returns:

  • (Boolean)


22
23
24
# File 'lib/positive_time_support/date_ext.rb', line 22

def holiday?
  ::HolidayJapan.check( ::Date.new( year , month , day ) )
end

#to_strf_date_jaObject



26
27
28
# File 'lib/positive_time_support/date_ext.rb', line 26

def to_strf_date_ja
  "#{ year }年#{ month }月#{ day }日"
end

#wday_jaObject Also known as: wday_ja_normal



10
11
12
# File 'lib/positive_time_support/date_ext.rb', line 10

def wday_ja
  "#{ wday_ja_short }曜"
end

#wday_ja_longObject



16
17
18
# File 'lib/positive_time_support/date_ext.rb', line 16

def wday_ja_long
  "#{ wday_ja_short }曜日"
end

#wday_ja_shortObject



6
7
8
# File 'lib/positive_time_support/date_ext.rb', line 6

def wday_ja_short
  WDAYS_JA_SHORT[ wday ]
end