| 776 | } |
| 777 | |
| 778 | checkDSTObserved() { |
| 779 | // 2nd sun March 2am to 1st sun Nov 2am |
| 780 | let today = new Date(); |
| 781 | let yr = today.getFullYear(); |
| 782 | let dst_start = new Date("March 14, "+yr+" 02:00:00"); // 2nd Sunday in March can't occur after the 14th |
| 783 | let dst_end = new Date("November 07, "+yr+" 02:00:00"); // 1st Sunday in November can't occur after the 7th |
| 784 | let day = dst_start.getDay(); // day of week of 14th |
| 785 | dst_start.setDate(14-day); // Calculate 2nd Sunday in March of this year |
| 786 | day = dst_end.getDay(); // day of the week of 7th |
| 787 | dst_end.setDate(7-day); // Calculate first Sunday in November of this year |
| 788 | if (today >= dst_start && today < dst_end) { //does today fall inside of DST period? |
| 789 | return true; //if so then return true |
| 790 | } |
| 791 | return false; //if not then return false |
| 792 | } |
| 793 | |
| 794 | setTimeFromText(tx) { // required format hh:mm or hhmm |
| 795 | let d = new Date(); |