ReferenceError: luxon is not defined

Which version of Obsidian / dataview are you using? It seems like a rather old variant since you’re still using luxon… Oh well…

Try the following:

Now as an ISO Date: `$= dv.date("now").toFormat("yyyy-MM-dd")`

Updated version of yours:  `$= dv.fileLink("Reviews/00 Dagen/" + dv.date("now").toFormat("yyyy-MM-dd"), false, "Review van Vandaag") `

Which produces this for me:
image

There are also options to use moment() within dataviewjs, but I find it a little confusing, as then all the momentjs date tokens are used, whilst when using dateformat and this toFormat the luxon date tokens are used. They are mostly the same, but there are differences, which I find a little confusing.

Take the following example:

luxon "DDDD" : `$= dv.date("now").toFormat("DDDD") `
moment "DDDD": `$= moment(dv.date("now")).format("DDDD") `

Which produces this output:
image

The first line is todays date in a localised format (that is Norwegian, by the way), and the second line lists the day of the year. Duh…

Some other differences:

  • d - day of the month vs day of week
  • dd - padded day of month vs two-letter day of week
  • YYYY - nothing vs years in four digits
  • S - millisecond, no padding vs fractional second (one digit)

And there are various format tokens only present in either variant, with Luxon having the most options (and they’ve got some many options that in itself is slightly confusing).

Update: By the way, you could also change your original reference to luxon into dv.luxon and get it working. Didn’t notice that before just now…

1 Like