Skip to content

Commit

Permalink
Fix date formatting in mailingService
Browse files Browse the repository at this point in the history
  • Loading branch information
fabian-emilius committed Jul 29, 2024
1 parent aa65356 commit 52ceb76
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions server/src/main/java/thesistrack/ls1/service/MailingService.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@
import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.time.Instant;
import java.util.*;

@Service
public class MailingService {
Expand Down Expand Up @@ -208,8 +207,12 @@ private String fillApplicationPlaceholders(String template, Application applicat

return template.replace("{{application.studyProgram}}", student.getStudyProgram())
.replace("{{application.studyDegree}}", student.getStudyDegree())
.replace("{{application.enrolledAt}}", simpleDateFormat.format(student.getEnrolledAt()))
.replace("{{application.desiredThesisStart}}", simpleDateFormat.format(application.getDesiredStartDate()))
.replace("{{application.enrolledAt}}", simpleDateFormat.format(
Date.from(Objects.requireNonNullElse(student.getEnrolledAt(), Instant.now())
)))
.replace("{{application.desiredThesisStart}}", simpleDateFormat.format(
Date.from(Objects.requireNonNullElse(application.getDesiredStartDate(), Instant.now())
)))
.replace("{{application.specialSkills}}", student.getSpecialSkills())
.replace("{{application.motivation}}", application.getMotivation())
.replace("{{application.interests}}", student.getInterests())
Expand Down

0 comments on commit 52ceb76

Please sign in to comment.