Module: BlackStack::DateTime::Misc

Defined in:
lib/functions.rb

Overview


Miscelaneous


Class Method Summary collapse

Class Method Details

.datetime_values_check(year, month, day, hour, minute, second) ⇒ Object



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/functions.rb', line 79

def self.datetime_values_check(year,month,day,hour,minute,second)
  if (year.to_i<1900 || year.to_i>=2100)
    return false
  end

  if (month.to_i<1 || month.to_i>12)
    return false
  end

  # TODO: Considerar la cantidad de dias de cada mes, y los anios biciestos. Buscar alguna funcion existente.
  if (day.to_i<1 || day.to_i>31)
    return false
  end

  if (hour.to_i<0 || hour.to_i>23)
    return false
  end

  if (minute.to_i<0 || minute.to_i>59)
    return false
  end

  if (second.to_i<0 || second.to_i>59)
    return false
  end

  return true
end