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



372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
# File 'lib/functions.rb', line 372

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