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



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/functions.rb', line 48

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