Scriptable Date Picker in Shortcut

Hi there, I’m trying to get the output of Scriptable’s date picker to appear in my shortcut, but currently I’m just getting an empty result.

Here’s a link to my shortcut currently: https://www.icloud.com/shortcuts/c645caeac1864929951b3f8a9154e85d

And here’s the code snippet I’m trying to use in Scriptable. I’m not really sure why it’s not working.

pick = new DatePicker()

test = pick.pickDateAndTime()
test.then(function(val){
  console.log(val)
  new CallbackURL("shortcuts://").open();
  return val
})

I’ve also tried using Script.setShortcutOutput, with no luck.

Please let me know if anyone has any suggestions for getting this working.

Given the date picker can’t be used from an inline script, here’s one approach based on what you had above.

Date Picker

dpPicker = new DatePicker();
dtTime = await dpPicker.pickDateAndTime();
Pasteboard.copyString(dtTime.toString());
new CallbackURL("shortcuts://").open();

Shortcut

Hope that helps.

Thank you, that works perfectly. And sorry for the late reply. Appreciate your help!