Skip to content

Commit

Permalink
Test: 타임존 UTC로 변경하여 테스트
Browse files Browse the repository at this point in the history
  • Loading branch information
chaewon-io committed Apr 15, 2024
1 parent 2300189 commit 31736f9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void cancelAppliedMyChallenge(String email, Long myChallengeId) {
public List<MyChallengeResponseDto> getMyChallengesListed(String email, ChallengeStatus status) {
Member member = getMemberByEmail(email);
List<MyChallenge> myChallengesListed;
ZonedDateTime todayStart = ZonedDateTime.now(ZoneId.of("GMT")).truncatedTo(ChronoUnit.DAYS);
ZonedDateTime todayStart = ZonedDateTime.now(ZoneId.of("UTC")).truncatedTo(ChronoUnit.DAYS);

switch (status) {
case PROGRESS:
Expand All @@ -78,7 +78,7 @@ public List<MyChallengeResponseDto> getMyChallengesListed(String email, Challeng
if(!myChallengesListed.isEmpty()) {
log.error("---------------myChallenge startDate : " + myChallengesListed.get(0).getStartDate());
if(myChallengesListed.get(0).getStartDate().equals(todayStart)) {
log.error("------------날짜 비교 테스트 성공 GMT");
log.error("------------날짜 비교 테스트 성공 UTC");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,14 @@ public class QuizServiceImpl implements QuizService {
@Override
public QuizResponseDto getTodaysQuiz(Long challengeGroupId) {
verificationService.IsChallengeGroupTextType(challengeGroupId);
ZonedDateTime today = ZonedDateTime.now(ZoneId.systemDefault()).truncatedTo(ChronoUnit.DAYS);

ZonedDateTime today = ZonedDateTime.now(ZoneId.of("UTC")).truncatedTo(ChronoUnit.DAYS);

Quiz quiz = findQuizByDate(challengeGroupId, today);

ZonedDateTime plusDate = quiz.getDate();
log.info("_____________________ todayQuiz : " + today);
log.info("_____________________ Quizdate : " + plusDate);
return new QuizResponseDto(plusDate, quiz.getQuestion());
}

Expand Down

0 comments on commit 31736f9

Please sign in to comment.