Read the statement by Michael Teeuw here.
Module Refresh Time
-
@cowboysdude but he wanted to wake up at a specific time of day
so,
create a date object with the target date and time,
extract its milliseconds,
subtract now ms from that= wait_ms,
setTimeout(fn, wait_ms) -
@sdetweil Yes you are right on both accounts :)
-
@cowboysdude I love it when you old timers get into it… I am looking at the @sdetweil suggestions. Thought there might have been an easier way.
-
@mumblebaj u can of course add ANOTHER library, only accessable from node_helper…
https://www.npmjs.com/package/node-cron
seems a lot of work for one little routine… with 1 line of code
and you can use moment too
https://stackoverflow.com/questions/36158193/javascript-set-a-new-date-to-tomorrow-8am
-
@sdetweil Yep, i will look at your suggestion. Keeps it nice and tidy
-
@mumblebaj that last link shows both Date() and moment() approaches