Skip to content

Conversation

codeconsole
Copy link
Contributor

@codeconsole codeconsole commented Oct 16, 2025

Show DateTime

7.0.0

Field Value
Calendar 2025-10-08 00:48:46 PDT
Date 2025-10-08 00:48:46 PDT
sql.Date Exception Thrown
sql.Time Exception Thrown
sql.Timestamp Exception Thrown
LocalTime Exception Thrown
Instant 2025-10-08T07:48:46.407254Z
Local Date Exception Thrown
Local DateTime 2025-10-08 00:48:46 PDT
OffsetDateTime 2025-10-08T00:48:46.407254-07:00
ZonedDateTime 2025-10-08T00:48:46.407254-07:00[America/Los_Angeles]

With This Fix

Field Value
Calendar 2025-10-08 00:48:46 PDT
Date 2025-10-08 00:48:46 PDT
sql.Date 2025-10-08 00:48:46 PDT
sql.Date 12:48 PM
sql.Time 12:48 PM
sql.Timestamp 2025-10-08 00:48:46 PDT
Instant 2025-10-08 00:48:46 PDT
Local Date 2025-10-08
Local DateTime 2025-10-08 00:48:46 PDT
OffsetDateTime 2025-10-08 00:48:46 PDT
ZonedDateTime 2025-10-08 00:48:46 PDT

Edit/Create DateTime

7.0.0

Field Value
Calendar Date Precision
Date Date Precision
sql.Date Date Precision
sql.Time Date Time Minute Precision
sql.Timestamp Broken
LocalTime Broken
Instant Broken
Local Date Broken
Local DateTime Date Time Minute Precision
OffsetDateTime Broken
ZonedDateTime Broken

With This Fix

Field Value
Calendar Date Precision
Date Date Precision
sql.Time Date Time Minute Precision
sql.Timestamp Broken
LocalTime Broken
Instant Date Precision
Local Date Date Precision
Local DateTime Date Time Minute Precision
OffsetDateTime Date Precision
ZonedDateTime Date Precision

Remaining JSON Issues:

Spring Boot

"time":"00:48:46","localTime":"00:48:46.407254",

Grails 7

"time":"2025-10-08T07:48:46.407Z","localTime":{"hour":0,"minute":48,"nano":407254000,"second":46}

@github-actions github-actions bot added the bug label Oct 16, 2025
@jdaugherty
Copy link
Contributor

We originally said "bug" fixes would only go in 7.0.1 and features in 7.1.0. I'm ok with the change going into 7.0.1, but we probably should make sure @jamesfredley & @matrei agree with this.

@codeconsole
Copy link
Contributor Author

codeconsole commented Oct 16, 2025

We originally said "bug" fixes would only go in 7.0.1 and features in 7.1.0. I'm ok with the change going into 7.0.1, but we probably should make sure @jamesfredley & @matrei agree with this.

Right, I think this is a bug fix because the new fields don't even work. @jdaugherty look at the Edit/Create view results

@codeconsole
Copy link
Contributor Author

I think we should move to second or even nanosecond precision in 7.1.x
Currently with dates in scaffold views, all time information is lost on update

@codeconsole
Copy link
Contributor Author

java.sql.Date on /show page results in

14:01:16,958 |-WARN in Logger[StackTrace] - No appenders present in context [default] for logger [StackTrace].
2025-10-17T14:01:16.959-07:00 ERROR 65880 --- [nio-8082-exec-4] .C.[.[.[.[dispatcherServletRegistration] : Servlet.service() for servlet [dispatcherServletRegistration] in context with path [] threw exception [Request processing failed: org.grails.gsp.GroovyPagesException: Error processing GroovyPageView: [Byte array resource [view:-,-,dateTime:show]:33] Error executing tag <f:display>: Unsupported field: HourOfDay] with root cause

java.time.temporal.UnsupportedTemporalTypeException: Unsupported field: HourOfDay
        at java.base/java.time.LocalDate.get0(LocalDate.java:698)
        at java.base/java.time.LocalDate.getLong(LocalDate.java:678)
        at java.base/java.time.format.DateTimePrintContext$1.getLong(DateTimePrintContext.java:205)
        at java.base/java.time.format.DateTimePrintContext.getValue(DateTimePrintContext.java:308)
        at java.base/java.time.format.DateTimeFormatterBuilder$NumberPrinterParser.format(DateTimeFormatterBuilder.java:2915)
        at java.base/java.time.format.DateTimeFormatterBuilder$CompositePrinterParser.format(DateTimeFormatterBuilder.java:2539)
        at java.base/java.time.format.DateTimeFormatter.formatTo(DateTimeFormatter.java:1905)
        at java.base/java.time.format.DateTimeFormatter.format(DateTimeFormatter.java:1879)
        at org.grails.plugins.web.DefaultGrailsTagDateHelper.format(DefaultGrailsTagDateHelper.groovy:108)
        at org.codehaus.groovy.vmplugin.v8.IndyInterface.selectMethod(IndyInterface.java:355)
        at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:321)
        at org.grails.plugins.web.taglib.FormatTagLib$_closure2.doCall(FormatTagLib.groovy:204)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
        at org.grails.taglib.TagOutput.captureTagOutput(TagOutput.java:84)
        at org.grails.taglib.TagLibraryMetaUtils$_registerMethodMissingForTags_closure3.doCall(TagLibraryMetaUtils.groovy:81)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
        at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:321)
        at grails.plugin.formfields.FormFieldsTagLib.renderDefaultDisplay(FormFieldsTagLib.groovy:964)

@sbglasius
Copy link
Contributor

@jdaugherty I agree that it could go into 7.0.1

@jamesfredley jamesfredley moved this to In Progress in Apache Grails Oct 22, 2025
@jamesfredley
Copy link
Contributor

jamesfredley commented Oct 22, 2025

Will want to confirm compatibility with grails.databinding.dateFormats in application.yml

grails:
  databinding:
    dateFormats: # used when parsing posted form fields
      - "yyyy-MM-dd'T'HH:mm:ss.SSSX"
      - "yyyy-MM-dd'T'hh:mm:ss'Z'"
      - "yyyy-MM-dd HH:mm:ss.S z"
      - "yyyy-MM-dd HH:mm:ss.S"
      - "yyyy-MM-dd'T'HH:mm:ssZ"
      - "yyyy-MM-dd'T'HH:mm:ss"
      - "yyyy-MM-dd HH:mm:ss"
      - "yyyy-MM-dd HH:mm"
      - "yyyy-MM-dd"
      - "HH:mm:ssZ"
      - "HH:mm:ss"

and the following from messages.properties

default.date.format=EEE, MMM d, yyyy h:mm:ss a, z
default.date.day.format=EEE, MMM d
default.date.time.format=h:mm a

@jamesfredley
Copy link
Contributor

https://grails.apache.org/docs/snapshot/ref/Tags%20-%20GSP/formatDate.html

While using java.time.LocalDate as the date value please specify the format attribute as the default (yyyy-MM-dd HH:mm:ss z) would fail to format because java.time.LocalDate does not have any time format.

@codeconsole
Copy link
Contributor Author

@jamesfredley for 7.0.1 we will just default to type="date"

@codeconsole codeconsole merged commit c27742f into apache:7.0.x Oct 22, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants