I would like to have a function which get start_day and end_day as two string type parameter and returns the list of dates inside the specified date span including start and end days, anyone can provide a efficient code block?
def get_list_of_dates(start_date, end_date)
...
return dates
end
def get_list_of_dates(start_date, end_date)
(Date.parse(start_date)..Date.parse(end_date)).to_a
end
If Date.parse
doesn't accept the string (it doesn't accept many formats), you may want to check out chronic.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With