-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
830 additions
and
468 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
src/main/java/ddingdong/ddingdongBE/common/utils/TimeParser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package ddingdong.ddingdongBE.common.utils; | ||
|
||
import java.time.LocalDateTime; | ||
import java.time.format.DateTimeFormatter; | ||
|
||
public class TimeParser { | ||
|
||
private static final String DATE_FORMAT = "yyyy-MM-dd HH:mm"; | ||
|
||
public static LocalDateTime parseToLocalDateTime(String dateString) { | ||
if (dateString == null || dateString.isBlank()) { | ||
return null; | ||
} | ||
|
||
return LocalDateTime.parse(dateString, DateTimeFormatter.ofPattern(DATE_FORMAT)); | ||
} | ||
|
||
public static LocalDateTime processDate(String dateString, LocalDateTime currentDate) { | ||
if (dateString == null) { | ||
return currentDate; | ||
} | ||
|
||
if (dateString.isBlank()) { | ||
return null; | ||
} | ||
|
||
return parseToLocalDateTime(dateString); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.