Skip to content

Commit

Permalink
fix: Fix calculateTimeUntilDeadline
Browse files Browse the repository at this point in the history
  • Loading branch information
nanna29 committed Aug 2, 2024
1 parent ef3de63 commit da2dd38
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ private String formatUpdatedAt(LocalDateTime updatedAt) {
private String calculateTimeUntilDeadline(LocalDateTime updatedAt, LocalDateTime deadline) {
Duration duration = Duration.between(updatedAt, deadline);
long days = duration.toDays();
return days > 0 ? "D-" + days : "공고 기한 마감";
if (days < 8 && days > 0) {
return "D-" + days;
}
else return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ private String formatUpdatedAt(LocalDateTime updatedAt) {
private String calculateTimeUntilDeadline(LocalDateTime updatedAt, LocalDateTime deadline) {
Duration duration = Duration.between(updatedAt, deadline);
long days = duration.toDays();
if (days>6){
return days > 0 ? "D-" + days : "공고 기한 마감";
if (days < 8 && days > 0) {
return "D-" + days;
}
else return null;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spring.datasource.password=testPW
# spring jpa
spring.jpa.database=mysql
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=create
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.format_sql=true


Expand Down

0 comments on commit da2dd38

Please sign in to comment.