Is it possible to use inline Dataview to automatically show the number of days in a month?

I would like to add the days in the month to my Dashboard (a work in progress) I have the day of the week, month, date, and year.

It would read:
February | 28 days.

I am unsure how to ask Dataview to give me the number of days in the current month.
Any help would be appreciatied.

If you tried doing $= console.log(dv.date("now")) you’ll see something like the following in the console (within Developers Tool), which you really should learn how to navigate if you’re going to do anything serious with either dataview and especially dataviewjs:

In this listing there are two which kind of stands out, monthLong and daysInMonth. So try the following on for size:

`$= const today = dv.date("now"); dv.span(today.monthLong + " | " + today.daysInMonth) `

Here I pull the current date, but you could use whatever date recognised by dataview, I reckon.

2 Likes

Thank you, the code ($= const today = dv.date("now"); dv.span(today.monthLong + " | " + today.daysInMonth) ) you provided solved my quest to show the number of days in the month. Thank you for your time.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.