My goal is to have NR update the cost per kWh based on the schedule that has been published by my utility provider. Currently they have published a pdf that shows the $/kWh for time periods through 2025. I would like to check the date (probably date.now) and determine what block it fits into and apply the appropriate rate. I'm not a JS programmer so this is not in my wheel house. I've found some code snippets but it appears I may be over complicating things.
var from = new Date("02/08/2017").getTime();
var to = new Date("05/08/2017").getTime();
var withinRange = today >= from && today <= to;
And here's the rate table:
effective date $/kWh
1 Oct 2017 0.10414
1 Apr 2021 0.10118
1 Apr 2022 0.09822
1 Apr 2023 0.09527
1 Apr 2024 0.09231
1 Apr 2025 0.08935
I would typically use an if-elseif structure, but I'm not sure if there's a better way in JS.