natehuangting opened a new issue, #28909: URL: https://github.com/apache/shardingsphere/issues/28909
I use IntervalShardingAlgorithm and the datetime-pattern is ''yyyy-MM-dd HH:mm:ss''. If the time passed when the user requests the Proxy is "2023-01-01 12:00:00", there will be no problem. If the time passed is "2023-01-01", a "String index out of range: 19" exception will occur. Why "2023-01-01" is passed instead of "2023-01-01 00:00:00" is because the gorm framework will remove the time and only keep the date when it finds that the time is "00:00:00". I think this is reasonable, and I hope Proxy can also support it, because MySQL also supports such delivery. <img width="1305" alt="企业微信截图_b3ac7dc1-7c43-45d3-be06-4701bf2b0085" src="https://github.com/apache/shardingsphere/assets/26433395/7de53ed3-343c-4686-a567-aebcabf18cd3"> My solution is as follows, I don’t know if it is reasonable? ` private LocalDateTime parseLocalDateTime(final Comparable<?> endpoint) { try { return LocalDateTime.parse(getDateTimeText(endpoint), dateTimeFormatter); } catch (final DateTimeParseException ex) { LocalDate date = LocalDate.parse(getDateTimeText(endpoint), DateTimeFormatter.ofPattern("yyyy-MM-dd")); return LocalDateTime.of(date, LocalTime.MIDNIGHT); } }` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
