I want to add some random time to a date time from another table using:
from_dataset("RESERVATION", "ResDateTime", ResID: __ResID) + minutes(random(10,15))
but I get this error:
error: no implicit conversion of ActiveSupport::Duration into String
here is the value returned without the ‘+minutes()’ :
2016-10-09 18:24:03
I also had this issue, and for anyone else that needs help, I solved it by casting the from_dataset()
function to a date using the date()
function:
date(from_dataset("RESERVATION", "ResDateTime", ResID: __ResID)) + minutes(random(10,15))
Otherwise, you are attempting to add a duration value (a number of days) to a string. This converts it to a duration value which can be manipulated.
Hope this helps.