From dc0b6a350316900f30342d9349263610936d6ad4 Mon Sep 17 00:00:00 2001 From: yxhwxn Date: Mon, 5 Aug 2024 17:09:45 +0900 Subject: [PATCH] =?UTF-8?q?Refactor:=20timezone=20=EC=84=A4=EC=A0=95=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/cmc/suppin/global/config/MailConfig.java | 8 +++++--- src/main/resources/application.yml | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/cmc/suppin/global/config/MailConfig.java b/src/main/java/com/cmc/suppin/global/config/MailConfig.java index 56ea75d..d82a995 100644 --- a/src/main/java/com/cmc/suppin/global/config/MailConfig.java +++ b/src/main/java/com/cmc/suppin/global/config/MailConfig.java @@ -8,7 +8,8 @@ import org.springframework.mail.javamail.MimeMessageHelper; import org.springframework.stereotype.Component; -import java.time.LocalDateTime; +import java.time.ZoneId; +import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; @Component @@ -26,8 +27,9 @@ public boolean sendMail(String toEmail, String code) { helper.setSubject("Suppin 인증번호"); // Format the current date and time - String formattedDateTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd, HH:mm")); - + String formattedDateTime = ZonedDateTime.now(ZoneId.of("Asia/Seoul")) + .format(DateTimeFormatter.ofPattern("yyyy-MM-dd, HH:mm")); + // Use StringBuilder to construct the HTML email body StringBuilder emailBody = new StringBuilder(); emailBody.append("") diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 1a2c453..b593742 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,6 +1,8 @@ spring: server: port: 8080 + jackson: + time-zone: Asia/Seoul datasource: url: ${DB_URL} username: ${DB_USER}