Day and Time Format

123 views
Skip to first unread message

Rory Gillies

unread,
May 15, 2023, 5:20:56 AM5/15/23
to weewx-user
I know there must be an easy answer to this but it's eluding me at the moment! I use the Neowx-Material skin and have created a custom Zambretti forecast card using the Weewx Forecast extension on the index.html page which looks like this:

Screenshot 2023-05-15 at 10.13.50.png

The code that displays the "Issued at" value is:

          <div class="col-3 text-muted font-small indigo-text">
          Issued at <br>
          $forecast.zambretti.issued_ts.format($Extras.Formatting.datetime_today)
          </div>

What I want it to read is "Issued at 09:00 on Monday 15" (using today as an example) but I can't seem to find the correct syntax. Any ideas?

Thanks in advance!

vince

unread,
May 15, 2023, 7:05:55 PM5/15/23
to weewx-user

Rory Gillies

unread,
May 16, 2023, 5:34:28 AM5/16/23
to weewx-user
Thanks Vince, but that's the problem, it doesn't seem to adhere to the normal formatting options. If I change the code to this:

          <div class="col-3 text-muted font-small indigo-text">
          Issued at <br>
          $forecast.zambretti.issued_ts.format($Extras.Formatting.datetime.format("%H:%M %d-%b"))
          </div>

Then the card displays this:

Screenshot 2023-05-16 at 10.31.41.png

But I want the time to be displayed before the day / date, i.e Issued at 09:00 Tue 16

gjr80

unread,
May 16, 2023, 7:04:08 AM5/16/23
to weewx-user
I know nothing about Neowx-material, so I have no idea what format $Extras.Formatting.datetime_today specifies, but have you tried $forecast.zambretti.issued_ts.format("%H:%M %d-%b")? I can't see any way that $Extras.Formatting.datetime.format("%H:%M %d-%b") will do what you want.

Note the correct syntax is for .format is  .format(format_string="your_format_string"), but omitting format_string= should work fine in your case.

Gary

vince

unread,
May 16, 2023, 2:37:40 PM5/16/23
to weewx-user
On Tuesday, May 16, 2023 at 2:34:28 AM UTC-7 Rory Gillies wrote:
Thanks Vince, but that's the problem, it doesn't seem to adhere to the normal formatting options. If I change the code to this:

          <div class="col-3 text-muted font-small indigo-text">
          Issued at <br>
          $forecast.zambretti.issued_ts.format($Extras.Formatting.datetime.format("%H:%M %d-%b"))
          </div>


You're going to have to provide all your customizations in order for anybody to hope to recreate your issue.   That means your "custom Zambretti forecast card" at a minimum, probably including anything you did with the forecast extension if that's a separate customization

 

vince

unread,
May 16, 2023, 4:00:11 PM5/16/23
to weewx-user
I did some fiddling - this works for me...

In the template...
<span class='issued'>Issued at $forecast.zambretti.issued_ts.format("%H:%M") on $forecast.zambretti.issued_ts.format("%a %d")</span>

In the resulting html....
<span class='issued'>Issued at 19:55 on Tue 16</span>

Rory Gillies

unread,
May 17, 2023, 3:42:29 AM5/17/23
to weewx-user
You're a star Vince, that worked perfectly.

Screenshot 2023-05-17 at 08.38.52.png

Thanks all for the help and suggestions. I know it may seem insignificant formatting but it's the proper way to display this type of observation.

Rory

Reply all
Reply to author
Forward
0 new messages