I was just recently informed of this and have now realized it is true. When a contact has a date included but no year specified, the date that scriptable sees will be incorrect. In a user’s case, it was 3 days and in my case it is 2 days.
Anyone else run into this? Seems when looking at the contact card in shortcuts and converting the vCard to .txt, the date shows up as the correct month and date but the year shows as 1604 with a note that the year is OMIT.
Shortcut vCard Text:
Contact in Contacts app:
Scriptable result:
The code I see this with is below
let contacts = await Contact.all([await ContactsContainer.default()])
let res = []
contacts = contacts.filter((cont) => {
conta = cont.dates.filter(d => (d.label == "_$!<Anniversary>!$_"))
if(conta.length>0){
log(`${cont.givenName} ${cont.familyName}`)
log(conta[0].value)
let contNew = {"contFirst":cont.givenName,"contLast":cont.familyName,"anni":cont.dates[0]['value']}
//log(cont.dates)
res.push(contNew)
}
})
log(res)
return JSON.stringify(res)