Welcome to the new home of the Cumulus Support forum.

Latest Cumulus release v1.9.4 (build 1099) - 28 November 2014
Latest Cumulus MX release v3.0.0 build 3046 - 02 January 2019. See the Wiki for download

Tag <#time> not working

Discussion and questions about Cumulus weather station software version 1. This section and its subforums are the main place to get help with Cumulus. Anything which is not specific to the type of weather station goes in here; for anything specific to a type of weather station, please use the appropriate subforum. Use the 'website development' section for any questions relating to creating or running a web site for Cumulus data. Discussion of the stations themselves in these sections is fine.
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 » Sat 26 Aug 2017 12:53 pm

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: 2537
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: XP SP3 - honest
Location: Dudley, West Midlands, UK

Re: Tag <#time> not working

Post by beteljuice » Sat 26 Aug 2017 1:02 pm

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: 5316
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Stretch Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Tag <#time> not working

Post by mcrossley » Sat 26 Aug 2017 5:55 pm

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 » Sun 27 Aug 2017 12:31 pm

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: 2537
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: XP SP3 - honest
Location: Dudley, West Midlands, UK

Re: Tag <#time> not working

Post by beteljuice » Sun 27 Aug 2017 2:27 pm

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: 462
Joined: Fri 27 Jul 2012 11:29 am
Weather Station: Final post in top ten topic
Operating System: Tempermental Win. 10 PC
Location: Moving

Re: Tag <#time> not working

Post by sfws » Sun 27 Aug 2017 4:49 pm

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 » Sun 27 Aug 2017 8:42 pm

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