Skip to content

Commit 0737927

Browse files
author
Nick Grippin
committed
minor fixes
1 parent 176f9ac commit 0737927

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

api/src/main/scala/hmda/api/http/institutions/submissions/SubmissionSignPaths.scala

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package hmda.api.http.institutions.submissions
22

3+
import java.time.{ ZoneOffset, ZonedDateTime }
4+
35
import akka.actor.{ ActorRef, ActorSystem }
46
import akka.event.LoggingAdapter
57
import akka.pattern.ask
@@ -130,9 +132,11 @@ trait SubmissionSignPaths
130132
val session = Session.getDefaultInstance(properties)
131133
val message = new MimeMessage(session)
132134

133-
val text = s"$username,\nCongratulations, you've completed filing your HMDA data for filing period ${submission.id.period}.\n" +
134-
s"We received your filing on: ${submission.end}\n" +
135-
s"Your receipt is:${submission.receipt}"
135+
val date = getFormattedDate
136+
137+
val text = s"$username,\n\nCongratulations, you've completed filing your HMDA data for filing period ${submission.id.period}.\n" +
138+
s"We received your filing on: $date\n" +
139+
s"Your receipt is: ${submission.receipt}"
136140
message.setFrom(new InternetAddress("no-reply@test.com"))
137141
message.setRecipients(Message.RecipientType.TO, address)
138142
message.setSubject("HMDA Filing Successful")
@@ -141,4 +145,15 @@ trait SubmissionSignPaths
141145
log.info(s"Sending message to $address with the message \n$text")
142146
Transport.send(message)
143147
}
148+
149+
private def getFormattedDate: String = {
150+
val offset = ZoneOffset.ofHours(-5)
151+
val zonedTime = ZonedDateTime.now(offset)
152+
153+
val day = zonedTime.getDayOfMonth
154+
val month = zonedTime.getMonthValue
155+
val year = zonedTime.getYear
156+
157+
s"$month/$day/$year"
158+
}
144159
}

0 commit comments

Comments
 (0)