Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Cumulus MX V4 beta test release 4.0.0 (build 4019) - 03 April 2024

Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

Tag <#time> not working

Discussion and questions about Cumulus weather station software version 1. This section is the main place to get help with Cumulus 1 software developed by Steve Loft that ceased development in November 2014.
Post Reply
User avatar
ZCH
Posts: 10
Joined: Mon 12 Nov 2012 10:14 am
Weather Station: Davis Vantage Pro
Operating System: Windows 7
Location: Wieringermeer, NL
Contact:

Tag <#time> not working

Post by ZCH »

http://www.meteo-wieringermeer.nl
From time to time the PC on which Cumulus works stops bij lack of power.
I want to warn vistors for outdated data.
Can anyone help?
I tried:

<script>
var DateTimeNow
var DateTimeUpdate
var DateDif
var Message
var Tmp
</script>
<body style="color: rgb(0, 0, 0); background-color: #838383;">
<!-- WARNING -->
<form name="myform4">
<!--<input type="hidden" name="formvar" value="2017-06-16 12:05">--> <!--This worked fine-->
<input type="hidden" name="formvar" value= <#time format="yyyy-mmmm-d hh:nn"> <!--The problem-->
</form>
<script type="text/javascript">
Tmp = document.myform4.formvar.value;
</script>
<script>
// get Cumulus date of update
alert ("begin"); //check
DateTimeNow = Number(new Date());
alert ("Nu: " + DateTimeNow); //check
DateTimeUpdate = Number(new Date(Tmp));
alert ("Update: " + DateTimeUpdate); //check
DateDif = DateTimeNow - DateTimeUpdate;
alert("Dif: " + DateDif); //check
// Warning. 300000 is 5 mins
if (DateDif > 300000) {
Message = "STORING WEERSTATION\n\nGeen updates ontvangen.\nRapport verouderd, waarnemingen kloppen niet.";
alert(Message);
}
</script>
etc, etc

Elsewhere, the tag works fine:
<caption>Observarions at <#time format="d mmmm yyyy hh:nn"> LT<br>
<b>Caution! </b> Not older than 5 minutes, otherwise failure.
</caption>
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: Tag <#time> not working

Post by beteljuice »

Try ....

Code: Select all

<input type="hidden" name="formvar" value= '<#time format="yyyy-mmmm-d hh:nn">'
Your javascript var isn't "quoted" ;)
Image
......................Imagine, what you will KNOW tomorrow !
User avatar
mcrossley
Posts: 12756
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Tag <#time> not working

Post by mcrossley »

And the <input> tag isn't terminated is it?
User avatar
ZCH
Posts: 10
Joined: Mon 12 Nov 2012 10:14 am
Weather Station: Davis Vantage Pro
Operating System: Windows 7
Location: Wieringermeer, NL
Contact:

Re: Tag <#time> not working

Post by ZCH »

Thank you very much.
I made a stupid mistake.
I tested next alternatives:
1) <input type="hidden" name="formvar" value="2017-06-16 12:05">
2) <input type="hidden" name="formvar" value= '<#time format="yyyy-mmmm-d hh:nn">' failed
3) <input type="hidden" name="formvar" value= '<#time format="yyyy-mmmm-d hh:nn">'> failed
4) <input type="hidden" name="formvar" value= <#time format="yyyy-mmmm-d hh:nn">> failed
5) <input type="hidden" name="formvar" value= <#time format='yyyy-mmmm-d hh:nn'>> failed
6) <input type="hidden" name="formvar" value= '<#time format="yyyy-mmmm-d hh:nn">'> failed
7) <input type="hidden" name="formvar" value= “<#time format="yyyy-mmmm-d hh:nn">”> failed
8) <input type="hidden" name="formvar" value= “<#time format='yyyy-mmmm-d hh:nn'>”> failed
Only 1) was Ok. But that's not the one I need.
In http://www.meteo-wieringermeer.nl/realtime.txt, the firt 17 characters show upload date and time.
I did not succeed in writing the proper javascript function to get them.

gerard.hageman@planet.nl
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: Tag <#time> not working

Post by beteljuice »

Before we start escaping quotes and things - it would be useful if you had a test page link so that we could see what the Cumulus formated date looks like in the input string.

Doesn't have to be a page that 'runs' - just the code after Cumulus has processed it.
Image
......................Imagine, what you will KNOW tomorrow !
sfws
Posts: 1183
Joined: Fri 27 Jul 2012 11:29 am
Weather Station: Chas O, Maplin N96FY, N25FR
Operating System: rPi 3B+ with Buster (full)

Re: Tag <#time> not working

Post by sfws »

I am a little confused, did you want the month as a number or as a word?
If you want the number, maybe you could try '<#update>' as I believe that may output in the ISO date time format you want. It may give a slightly different time because it does not reflect the real-time in the file you quote, but surely it would address
ZCH wrote:I want to warn vistors for outdated data.
The code you could try with month as number is

Code: Select all

<input type="hidden" name="formvar" value="<#update>">
If you want month as word and the space, you could eliminate one set of quotes with

Code: Select all

<input type="hidden" name="formvar" value= '<#time format=yyyy-mmmm-d> <#time format=hh:nn>'>
EDITs - I missed a closing bracket on Cumulus web tag!
BTW - The first post in the thread contains at the start a URL to the page where this is being used!
Last edited by sfws on Mon 28 Aug 2017 3:54 pm, edited 2 times in total.
User avatar
ZCH
Posts: 10
Joined: Mon 12 Nov 2012 10:14 am
Weather Station: Davis Vantage Pro
Operating System: Windows 7
Location: Wieringermeer, NL
Contact:

Re: Tag <#time> not working

Post by ZCH »

Thank you all for your help.
This proved to be the solution:
<input type="hidden" name="formDate" value= '<#time format="yyyy-m-d hh:nn">'>
Post Reply