Format createdAt in appeal emails to UTC timezone and improve readability.
This commit is contained in:
parent
2e89fcec66
commit
0b4c1ccebf
|
|
@ -13,6 +13,9 @@ import org.springframework.stereotype.Service;
|
||||||
import org.thymeleaf.context.Context;
|
import org.thymeleaf.context.Context;
|
||||||
import org.thymeleaf.spring6.SpringTemplateEngine;
|
import org.thymeleaf.spring6.SpringTemplateEngine;
|
||||||
|
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
|
|
@ -53,7 +56,9 @@ public class AppealMail {
|
||||||
Context context = new Context();
|
Context context = new Context();
|
||||||
context.setVariable("appeal", appeal);
|
context.setVariable("appeal", appeal);
|
||||||
context.setVariable("history", history);
|
context.setVariable("history", history);
|
||||||
context.setVariable("createdAt", appeal.createdAt().toString());
|
context.setVariable("createdAt", appeal.createdAt()
|
||||||
|
.atZone(ZoneId.of("UTC"))
|
||||||
|
.format(DateTimeFormatter.ofPattern("yyyy MMMM dd hh:mm a '(UTC)'")));
|
||||||
context.setVariable("active", history.getUntil() <= 0 || history.getUntil() > System.currentTimeMillis());
|
context.setVariable("active", history.getUntil() <= 0 || history.getUntil() > System.currentTimeMillis());
|
||||||
String content = templateEngine.process("appeal-email", context);
|
String content = templateEngine.process("appeal-email", context);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user