Was originally posted this to ask for help, but I have worked out the kinks and this works if anyone wants to use it. I assembled from other codes/advice I found (and owe much learning to Tom G). This is taking two dates from datepickr calendar and giving back the correct number of working days in between. The jQuery can be edited if specific holidays need to be edited.I have this in the header: https://cdnjs.cloudflare.com/ajax/libs/flatpickr/4.6.3/flatpickr.js">https://cdnjs.cloudflare.com/ajax/libs/flatpickr/4.6.3/flatpickr.css" rel="stylesheet" />https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js">The html for the question is this (It makes the two text entry fields to display the datepickr and "calc" button to get answer): Biweekly Pay Periods: Calc This is my javascript (posted below)
Hi! Please forgive my code - I'm a newbie and have struggled at this for 2 weeks, so I can't remember which "test" this is. I'm making a salary calculator, had javascript working fine to take two dates and find the difference in days between. Problems is that I need Business days only. I installed moment.js and a Business days version but I have no idea how to get it to work with the code. I tried embedding the start and end date, didn't seem to make a difference. I just need any way at all to take my two user entered dates and find the number of business days (weekdays) in between. Please help and thank you! { var startDate = new Date("$${q://QID13/ChoiceTextEntryValue/4}").value(); var endDate = new Date("${q://QID13/ChoiceTextEntryValue/5}").value(); const calcBusinessDays = (startDate, endDate) => { const day = moment(startDate); let businessDays = 0; while (day.isSameOrBefore(endDate, 'day')) { if (day.day() !== 0 && day.day() !== 6) { businessDays++; } day.add(1, 'd
Already have an account? Login
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.
Sorry, we're still checking this file's contents to make sure it's safe to download. Please try again in a few minutes.
Sorry, our virus scanner detected that this file isn't safe to download.