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



427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
# File 'lib/functions.rb', line 427

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