method
_valid_nth_kday?
v1_9_1_378 -
Show latest stable
-
0 notes -
Class: Date
- 1_8_6_287
- 1_8_7_72
- 1_8_7_330
- 1_9_1_378 (0)
- 1_9_2_180 (0)
- 1_9_3_125
- 1_9_3_392
- 2_1_10
- 2_2_9
- 2_4_6
- 2_5_5
- 2_6_3
- What's this?
_valid_nth_kday?(y, m, n, k, sg=GREGORIAN)
public
Hide source
# File lib/date.rb, line 673 def _valid_nth_kday? (y, m, n, k, sg=GREGORIAN) # :nodoc: if k < 0 k += 7 end if n < 0 ny, nm = (y * 12 + m).divmod(12) nm, = (nm + 1) .divmod(1) ny, nm, nn, nk = jd_to_nth_kday(nth_kday_to_jd(ny, nm, 1, k, sg) + n * 7, sg) return unless [ny, nm] == [y, m] n = nn end jd = nth_kday_to_jd(y, m, n, k, sg) return unless [y, m, n, k] == jd_to_nth_kday(jd, sg) jd end