Welcome to the Cumulus Support forum.
Latest Cumulus MX V4 release 4.4.2 (build 4085) - 12 March 2025
Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 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
If you are posting a new Topic about an error or if you need help PLEASE read this first viewtopic.php?p=164080#p164080
Latest Cumulus MX V4 release 4.4.2 (build 4085) - 12 March 2025
Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 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
If you are posting a new Topic about an error or if you need help PLEASE read this first viewtopic.php?p=164080#p164080
MinutesSinceLastRainTip
Moderator: daj
- ace2
- Posts: 679
- Joined: Tue 14 Jan 2014 12:38 pm
- Weather Station: maxkon ws-1081pc
- Operating System: windows 7 & 8
- Location: Adelaide, south Australia, Australia
- Contact:
Re: MinutesSinceLastRainTip
both produce the same results??
CHRIS

web site
http://www.ace2weather.com
Follow me on Twitter
http://tinyurl.com/kwlr9re
YouTube channel
http://tinyurl.com/lehwpgp
Facebook page
http://tinyurl.com/k3sap4s
Tiny URL links used
web site
http://www.ace2weather.com
Follow me on Twitter
http://tinyurl.com/kwlr9re
YouTube channel
http://tinyurl.com/lehwpgp
Facebook page
http://tinyurl.com/k3sap4s
Tiny URL links used
- mcrossley
- Posts: 14388
- Joined: Thu 07 Jan 2010 9:44 pm
- Weather Station: Davis VP2/WLL
- Operating System: Bullseye Lite rPi
- Location: Wilmslow, Cheshire, UK
- Contact:
Re: MinutesSinceLastRainTip
Actually not very elegant - now I have a keyboard! - more elegant would be to put it in a closure (=anonymous function - to avoid polluting/clashing with the global namespace) and cater for zero values...steve wrote:Thanks, Mark, that's much more elegant than my effort would have been!
Code: Select all
<script type="text/javascript">
(function(){
var days = Math.floor(<#MinutesSinceLastRainTip>/24/60);
var hrs = Math.floor(<#MinutesSinceLastRainTip>/60%24);
var mins = Math.floor(<#MinutesSinceLastRainTip>%60);
function plur(x){return x === 1 ? '' : 's'};
document.write(days + ' Day' + plur(days) + ' : ' + hrs + ' Hr' + plur(hrs) + ' : ' + mins + ' Min' + plur(mins));
}());
</script>
Last edited by mcrossley on Sun 23 Feb 2014 10:56 am, edited 1 time in total.
- mcrossley
- Posts: 14388
- Joined: Thu 07 Jan 2010 9:44 pm
- Weather Station: Davis VP2/WLL
- Operating System: Bullseye Lite rPi
- Location: Wilmslow, Cheshire, UK
- Contact:
Re: MinutesSinceLastRainTip
Not sure what you mean? Your home page still has Steve's original JS code in it?ace2 wrote:both produce the same results??
- ace2
- Posts: 679
- Joined: Tue 14 Jan 2014 12:38 pm
- Weather Station: maxkon ws-1081pc
- Operating System: windows 7 & 8
- Location: Adelaide, south Australia, Australia
- Contact:
Re: MinutesSinceLastRainTip
just wondering if the results would be the same, that's all. and yes I'm using Steve's code.
mcrossley code should have the same output result???
mcrossley code should have the same output result???
CHRIS

web site
http://www.ace2weather.com
Follow me on Twitter
http://tinyurl.com/kwlr9re
YouTube channel
http://tinyurl.com/lehwpgp
Facebook page
http://tinyurl.com/k3sap4s
Tiny URL links used
web site
http://www.ace2weather.com
Follow me on Twitter
http://tinyurl.com/kwlr9re
YouTube channel
http://tinyurl.com/lehwpgp
Facebook page
http://tinyurl.com/k3sap4s
Tiny URL links used
- steve
- Cumulus Author
- Posts: 26672
- Joined: Mon 02 Jun 2008 6:49 pm
- Weather Station: None
- Operating System: None
- Location: Vienne, France
- Contact:
Re: MinutesSinceLastRainTip
Mark's code adds the enhancement to display the singular form for day/hour/minute when the value is 1.
Steve
- ace2
- Posts: 679
- Joined: Tue 14 Jan 2014 12:38 pm
- Weather Station: maxkon ws-1081pc
- Operating System: windows 7 & 8
- Location: Adelaide, south Australia, Australia
- Contact:
Re: MinutesSinceLastRainTip
steve wrote:Mark's code adds the enhancement to display the singular form for day/hour/minute when the value is 1.
mm, which one do I steal now??
CHRIS

web site
http://www.ace2weather.com
Follow me on Twitter
http://tinyurl.com/kwlr9re
YouTube channel
http://tinyurl.com/lehwpgp
Facebook page
http://tinyurl.com/k3sap4s
Tiny URL links used
web site
http://www.ace2weather.com
Follow me on Twitter
http://tinyurl.com/kwlr9re
YouTube channel
http://tinyurl.com/lehwpgp
Facebook page
http://tinyurl.com/k3sap4s
Tiny URL links used
-
Alan
- Posts: 51
- Joined: Sun 14 Mar 2010 9:41 am
- Weather Station: WH1091
- Operating System: Win 7
- Location: Sydney
Re: MinutesSinceLastRainTip
Hello Mark, Your code works beautifully.
Between when Steve supplied his code and when you supplied your more elegant version I had managed to modify Steve's code to return only that which has value (ie if only minutes value then only minutes displayed and of course if only minutes and hours value then only minutes and hours displayed and so on... somewhat akin to auto ranging on a measuring instrument). This was fine but of course it only had plural nomenclature.
However, no matter how much I try I can not replicate the same action in your code (post probably because your version is beyond me... many things in it that I don't understand at this stage). Do you have any suggestions as to how this could be achieved?
Regards
Alan
PS
Please delete reference to the above as I have now managed to cobble together the appropriate code.
In any event I wish to thank you for the code you supplied and for your time and effort.
All the best.
Alan
Between when Steve supplied his code and when you supplied your more elegant version I had managed to modify Steve's code to return only that which has value (ie if only minutes value then only minutes displayed and of course if only minutes and hours value then only minutes and hours displayed and so on... somewhat akin to auto ranging on a measuring instrument). This was fine but of course it only had plural nomenclature.
However, no matter how much I try I can not replicate the same action in your code (post probably because your version is beyond me... many things in it that I don't understand at this stage). Do you have any suggestions as to how this could be achieved?
Regards
Alan
PS
Please delete reference to the above as I have now managed to cobble together the appropriate code.
In any event I wish to thank you for the code you supplied and for your time and effort.
All the best.
Alan