Can I format an arbitrary number with a unit label in a report?

86 views
Skip to first unread message

michael.k...@gmx.at

unread,
Dec 2, 2023, 1:47:00 AM12/2/23
to weewx-user
I have a report that reports the rain sum for the last 365 days:

$span(day_delta=365).rain.sum

I want to label this value like so:

365 days: 997mm

Is there a way to format the number 365 with $units.labels.day?
Something like:

$format(365, $units.labels.day) => 365 days
$format(1, $units.labels.day) => 1 day








Tom Keffer

unread,
Dec 2, 2023, 5:08:20 PM12/2/23
to weewx...@googlegroups.com
Something like

$span(day_delta=365).length.day.format("%d") <br/>
$span(day_delta=1).length.day.format("%d")

will generate

365 days
1 day



--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/ce86da41-9f28-41cf-a5c1-bd07b0990cb6n%40googlegroups.com.

michael.k...@gmx.at

unread,
Dec 3, 2023, 12:30:48 PM12/3/23
to weewx-user
Thank you!
Reply all
Reply to author
Forward
0 new messages