Access moment.js in a TaskPaper script

You mention Moment.js is used for parsing dates in TaskPaper. Is there a global variable, or some way we can access Moment from inside a TaskPaper script?

Alternatively, Apple’s documented way to import/require scripts is not working for me. Does this work for anyone else?

I’m not sure about Apple’s import method, but moment is actually available in TaskPaper’s default script context.

Here’s an example:

function TaskPaperContextScript(editor) {
  var outline = editor.outline
  var item = outline.createItem(moment().format('MMMM Do YYYY, h:mm:ss a'))

  script: TaskPaperContextScript.toString()

This is undocumented and could change in future, but I don’t expect it to.

Ah perfect, thanks.