A date created by javascript new Date(); is no longer a valid date per lucee.
isdate(‘Wed Sep 18 2024 09:20:47 GMT-0700 (Pacific Daylight Time)’) = false
|Version |Lucee 6.1.0.243|
|Version Name |Gelert|
|Release date |Jul 19, 2024|
|Loader Version |6.0.3.1|
|Servlet Container |Apache Tomcat/9.0.89|
|Java |11.0.23 (Eclipse Adoptium) 64bit|
|OS |Windows Server 2022 (10.0) 64bit|
|Architecture |64bit |
Load this code to reproduce:
<cfif structKeyExists(FORM, 'dtTest')>
<cfdump var="#isdate(FORM.dtTest)#" label="isdate('#FORM.dtTest#')">
<cfdump var="#dateTimeFormat(FORM.dtTest, "yyyy-MM-dd HH:nn:ss zzzz")#"> <!--- example: Wed Sep 18 2024 08:57:57 GMT-0700 (Pacific Daylight Time) --->
<cfelse>
<div id="dtTest"></div>
<script>
var dtTest = new Date();
console.log(dtTest);
fetch('', {
method: 'POST',
body: "dtTest="+escape(dtTest)
}).then(response => {
return response.text();
}).then(response => {
document.getElementById('dtTest').innerHTML = response;
})
</script>
</cfif>
Can’t convert value [Wed Sep 18 2024 09:20:47 GMT-0700 (Pacific Daylight Time)] to a datetime value
lucee.runtime.exp.ExpressionException: Can't convert value [Wed Sep 18 2024 09:20:47 GMT-0700 (Pacific Daylight Time)] to a datetime value at lucee.runtime.functions.displayFormatting.DateTimeFormat.invoke(DateTimeFormat.java:80) at lucee.runtime.functions.displayFormatting.DateTimeFormat.invoke(DateTimeFormat.java:73) at lucee.runtime.functions.displayFormatting.DateTimeFormat.call(DateTimeFormat.java:65) at playground.dtest_cfm$cf.call(/playground/dtest.cfm:3) at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:1050) at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:944) at lucee.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:213) at lucee.runtime.listener.ModernAppListener.onRequest(ModernAppListener.java:100) at lucee.runtime.PageContextImpl.execute(PageContextImpl.java:2731) at lucee.runtime.PageContextImpl._execute(PageContextImpl.java:2718) at lucee.runtime.PageContextImpl.executeCFML(PageContextImpl.java:2689) at lucee.runtime.engine.Request.exe(Request.java:45) at lucee.runtime.engine.CFMLEngineImpl._service(CFMLEngineImpl.java:1155) at lucee.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:1112) at lucee.loader.engine.CFMLEngineWrapper.serviceCFML(CFMLEngineWrapper.java:97) at lucee.loader.servlet.CFMLServlet.service(CFMLServlet.java:51) at javax.servlet.http.HttpServlet.service(HttpServlet.java:623) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:199) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:144) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:168) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:144) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:168) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:481) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:130) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:660) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:346) at org.apache.coyote.ajp.AjpProcessor.service(AjpProcessor.java:424) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:928) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1791) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52) at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1190) at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:63) at java.base/java.lang.Thread.run(Unknown Source)```