Flowdock
method

_valid_nth_kday?

Importance_0
Ruby latest stable (v1_9_3_392) - 0 notes - Class: Date

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v1_9_2_180) is shown here.

_valid_nth_kday?(y, m, n, k, sg=GREGORIAN) public

No documentation

This method has no description. You can help the Ruby community by adding new notes.

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
Register or log in to add new notes.