[ 
https://issues.apache.org/jira/browse/VELOCITY-956?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17876411#comment-17876411
 ] 

Claude Brisson commented on VELOCITY-956:
-----------------------------------------

I have the following test template:

{code}
#set( $inTimeZone = $date.getTimeZone().getTimeZone('Europe/Berlin') )

#set( $outTimeZone = $date.getTimeZone().getTimeZone('Asia/Shanghai') )

#set( $locale = $date.getLocale() )

#set( $myDate = $convert.parseDate("2022-04-22 00:00","yyyy-MM-dd 
HH:mm",$locale,$inTimeZone)) 

inTimeZone = $inTimeZone
outTimeZone = $outTimeZone
locale = $locale
myDate = $myDate
${date.format('yyyy-MM-dd hh:mm a',$myDate,$locale,$outTimeZone)}
{code}

I could not exactly reproduce your problem: with engine 2.3 and tools 3.1, as 
well with engine 1.7 and tools 2.0, the call $convert.parseDate returns null, I 
don't investigate further for now, I'm focusing on the engine issues.


> velocity 1.7 vs velocity 2.3: evaluation of scripts with empty value is not 
> backward compatible
> -----------------------------------------------------------------------------------------------
>
>                 Key: VELOCITY-956
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-956
>             Project: Velocity
>          Issue Type: Bug
>          Components: Engine, Scripting
>    Affects Versions: 2.3
>            Reporter: ambika
>            Priority: Major
>
> {*}Script{*}:     
>  
>   "vLATE_GATE_IN_6":"#set( $inTimeZone = 
> $date.getTimeZone().getTimeZone('Europe/Berlin') )\n\n#set( $outTimeZone = 
> $date.getTimeZone().getTimeZone('Asia/Shanghai') )\n\n#set( $locale = 
> $date.getLocale() )\n\n#set( $myDate = 
> $convert.parseDate(${*}{lead.lateGateIn}{*},\"yyyy-MM-dd 
> HH:mm\",$locale,$inTimeZone) )\n\n${date.format('yyyy-MM-dd hh:mm 
> a',$myDate,$locale,$outTimeZone)} "
> {*}note{*}: lead.lateGateIn = "" in the values 
> there are multiple other scripts vLATE_GATE_IN_5, vLATE_GATE_IN_4 but in the 
> script vLATE_GATE_IN_4 , the values for convert.parseDate is given as below:
> $convert.parseDate("2022-04-22") 
>  
> {*}Issue{*}: 
> Older version of velocity evaluates the script vLATE_GATE_IN_6 to: 
> |Time):\\n\\n\\n\\n\\n2022-04-22 11:00 AM|
>  
> Newer version of velocity evaluates the script vLATE_GATE_IN_6 to: 
> | |Time):\\n\\n\\n\\n\\n${date.format('yyyy-MM-dd hh:mm 
> a',$myDate,$locale,$outTimeZone)}| |



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org
For additional commands, e-mail: dev-h...@velocity.apache.org

Reply via email to