Closed stvdo closed 12 months ago
There are some helper functions available in the data namespace that you might like to explore. Using your example:
import { data } from "@i2analyze/i2connect";
// your parsing code here
entity.setProperties({
'Date of Birth': data.createLocalDateTime( dob )
});
Thanks again Ralph!
Good afternoon,
I try to add a DOB to a person. But I am struggling to get it in the WriteableDate format. Please can you advise me what to do to get it working?
The DOB format in the source: 8/16/1965
The code I have at the moment
_console.log('DOB', datum.date_of_birth); console.log('DateTime', Date.now()); const dob = datum.date_of_birth ? new Date(Number(datum.date_of_birth.split("/")[2]), Number(datum.date_of_birth.split("/")[1]), Number(datum.date_of_birth.split("/")[0])) : undefined;
entity.setProperties({ 'First (Given) Name': datum.first_name, 'Family Name': datum.last_name, 'Gender': datum.gender ? datum.gender : '', 'Place of Birth': datum.place_of_birth ? datum.place_ofbirth : '', // TODO: DOB gives an error 'Date of Birth': dob ? dob : undefined, });
And the error message.