Skip to content

Commit 9ce6baa

Browse files
committed
Update of ChargeRate.js to have the end date use an Time of end of day 23:59 after creating a variable calld endofDay
1 parent 4cd1d08 commit 9ce6baa

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

onprc_billing/resources/queries/onprc_billing/chargeRates.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,18 @@ function beforeUpdate(row, errors){
1616

1717
function beforeUpsert(row, errors){
1818
if (row.startDate){
19+
// normalize to date-only (00:00)
1920
row.startDate = ldkUtils.removeTimeFromDate(row.startDate);
2021
}
2122

2223
if (row.endDate){
23-
row.endDate = ldkUtils.removeTimeFromDate(row.endDate);
24+
// normalize to date-only first
25+
var cleanDate = ldkUtils.removeTimeFromDate(row.endDate);
26+
27+
// create a new date object set to 23:59
28+
var endOfDay = new Date(cleanDate);
29+
endOfDay.setHours(23, 59, 0, 0);
30+
31+
row.endDate = endOfDay;
2432
}
2533
}

0 commit comments

Comments
 (0)