Contact dates without a year interpret the wrong date

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)

@simonbs do you know of this issue already?

Hi Did you manage to fix this issue?

It is vey important to fix this as it is embarrassing to wish on wrong dates.

I agree with you. I have not found a good fix for it yet unfortunately. The only thing I can think of is I forcing a year to be input with the date. It seems if the year is included then the issue does not happen. However, this needs to happen before the information is given to Scriptable, which, for me, means a much larger tear up of the shortcut

@simonbs , any ideas why a contact date without a year would generate the wrong date? It’s a puzzling phenomenon to me. The date shows with some offset by 1-3 days depending on user it seems, and the year of 1604 gets replaced by 0001.

@simonbs this is still an issue with Scriptable

Edit: fixed now. Thanks Simon!