For a scheduling app, I am receiving a time stamp as something similar to a localdatetime
. Specifically, it’s generated by an HTML datetime-local
input, as YYYY-MM-DDTHH:MM
, and that works just fine when passed to localdatetime
.
The node representing the appointment location has a timezone
property, so I was thinking of building a localdatetime
and then attaching the time zone after that, but I can’t figure out how to convert a localdatetime
to a datetime
by bolting on a given timezone. datetime(localdatetime($timestamp))
adds a time zone, but sets it to UTC and that’s not quite what I want. I want to be able to provide that time zone.
An alternative I thought of was to break down the localdatetime
into component parts and rebuild the datetime
from that, but apoc.date.fields
doesn’t return datetime
-compatible map keys. What I’m looking for is something like this:
MATCH (office:Office { id: $office_id })
CREATE (appt:Appointment {
timestamp: datetime(
localdatetime($appointment_time),
{ timezone: office.timezone }
)
})
Obviously this doesn’t work since datetime
only takes a single argument but is there a way to do something like this?