Skip to content

Commit

Permalink
Refactor: timezone 설정 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
yxhwxn committed Aug 5, 2024
1 parent 80025f4 commit 91c3ca7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main/java/com/cmc/suppin/global/config/MailConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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("<!DOCTYPE html>")
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
spring:
server:
port: 8080
jackson:
time-zone: Asia/Seoul
datasource:
url: ${DB_URL}
username: ${DB_USER}
Expand Down

0 comments on commit 91c3ca7

Please sign in to comment.