Updated code

This commit is contained in:
Piyush
2025-02-27 12:17:47 +05:30
parent 1e836c9a80
commit bc2a546012
2 changed files with 6 additions and 5 deletions

View File

@@ -1649,14 +1649,11 @@ public class ApplicationDao {
}
public static LocalDateTime parseStringToLocalDateTime(String timestampStr) {
// Use ISO_LOCAL_DATE_TIME to parse the input string
return LocalDateTime.parse(timestampStr, DateTimeFormatter.ISO_LOCAL_DATE_TIME);
}
private void applyDateFilter(Path<?> fieldPath, CriteriaBuilder criteriaBuilder, List<Predicate> predicates, Object value, MatchModeEnum matchMode, Root<?> root) {
if (fieldPath.getJavaType().equals(LocalDateTime.class)) {
LocalDateTime testDateTime = parseStringToLocalDateTime(value.toString());
LocalDateTime testDateTime = DateTimeUtil.parseStringToLocalDateTime(value.toString());
MatchModeEnum mode = MatchModeEnum.fromObject(matchMode.getValue());

View File

@@ -92,6 +92,10 @@ public class DateTimeUtil {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
return LocalDateTime.parse(dateTimeStr, formatter);
}
public static LocalDateTime parseStringToLocalDateTime(String timestampStr) {
// Use ISO_LOCAL_DATE_TIME to parse the input string
return LocalDateTime.parse(timestampStr, DateTimeFormatter.ISO_LOCAL_DATE_TIME);
}
public static String parseLocalTimeToString(LocalTime time, String format) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(format);