module FFaker::Time
def datetime(params = {})
Experimental RBS support (using type sampling data from the type_fusion
project).
def datetime: (?Hash params) -> DateTime
This signature was generated using 1 sample from 1 application.
def datetime(params = {}) years_back = params[:year_range] || 5 latest_year = params[:year_latest] || 0 year = (rand * years_back).ceil + (::DateTime.now.year - latest_year - years_back) month = rand(1..12) day = rand(1..Date.new(year, month, -1).day) hours = params[:hours] || rand(0..23) minutes = params[:minutes] || rand(0..59) series = [date = ::DateTime.new(year, month, day, hours, minutes)] return date unless params[:series] params[:series].each do |some_time_after| series << series.last + (rand * some_time_after).ceil end series end