Skip to content

Commit

Permalink
Using days if no to and from date are present to make the calculation (
Browse files Browse the repository at this point in the history
…#320)

Co-authored-by: Pavilion Sahota <pavilion.sahota@justice.gov.uk>
  • Loading branch information
pavilionsahota and Pavilion Sahota authored May 2, 2024
1 parent c36ced0 commit 435eaf0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion server/routes/remandRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,11 +345,16 @@ export default class RemandRoutes {
unusedDeductions,
)

const days =
!sessionAdjustment.fromDate && !sessionAdjustment.toDate
? sessionAdjustment.days
: daysBetween(new Date(sessionAdjustment.fromDate), new Date(sessionAdjustment.toDate))

return res.render('pages/adjustments/remand/edit', {
model: new RemandChangeModel(
{
...sessionAdjustment,
days: daysBetween(new Date(sessionAdjustment.fromDate), new Date(sessionAdjustment.toDate)),
days,
},
dbAdjustment,
sentencesAndOffences,
Expand Down

0 comments on commit 435eaf0

Please sign in to comment.