raducotescu commented on a change in pull request #11:
URL:
https://github.com/apache/sling-org-apache-sling-scripting-sightly/pull/11#discussion_r673039030
##########
File path:
src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/FormatFilterExtension.java
##########
@@ -77,12 +81,14 @@ public Object call(final RenderContext renderContext,
Object... arguments) {
if (hasPlaceHolders) {
return getFormattedString(runtimeObjectModel, source,
formatObject);
}
+
try {
- // somebody will hate me for this
- new SimpleDateFormat(source);
+ // try to parse as DateTimeFormatter
Review comment:
I'm afraid I don't understand the question. The code before attempted to
check if the passed string was a valid date format pattern, which is similar to
what the new code does.
##########
File path:
src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/FormatFilterExtension.java
##########
@@ -77,12 +81,14 @@ public Object call(final RenderContext renderContext,
Object... arguments) {
if (hasPlaceHolders) {
return getFormattedString(runtimeObjectModel, source,
formatObject);
}
+
try {
- // somebody will hate me for this
- new SimpleDateFormat(source);
+ // try to parse as DateTimeFormatter
Review comment:
Ah, that's simple - you have no `type` option passed along the `format`
option, so we have to figure out what kind of pattern the user provided.
--
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]