-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot format date #225
Comments
Thanks for raising this bug. What you're doing should be working. I'll take a look when I get to a computer. |
I can't see why setting the dateformat on the template is not working. I'll try to do some more investigation on the weekend. I was able to use datetool (in version 1.2.4) with the following Velocity template... {
"startDate": "$dateTool.format('iso_tz', ${build.StartDate.Time})"
"currentTime": "$dateTool.format('iso_tz', $dateTool)"
} outputs... {
"startDate": "2023-08-07T22:57:38Z"
"currentTime": "2023-09-01T10:23:28Z"
}
|
I'll also patch 2.0.0 with the dateTool so that is same as 1.2.4 and release a new 2.0 RC. Hopefully will get that out on the weekend too. |
You may have already seen this issue all about dates: #222 |
I was able to get #set($myDate = $dateTool.format("yyyy-MM-dd'T'HH:mm:ssZ",$dateTool))
{
"iso_tz": "$dateTool.format('iso_tz',$dateTool)",
"myDate": "$myDate"
} It doesn't use Z for zulu time, but prints the offset (+0000) {
"iso_tz": "2023-09-01T10:58:12Z",
"myDate": "2023-09-01T10:58:12+0000"
} |
Or you can set the format.... #set($myDate = $dateTool.format("yyyy-MM-dd'T'HH:mm:ssZ",$dateTool))
#set($myFormat = "yyyy-MM-dd'T'HH:mm:ssZ")
{
"iso_tz": "$dateTool.format('iso_tz',$dateTool)",
"myDate": "$myDate",
"myFormat": "$dateTool.format($myFormat,$dateTool)"
} {
"iso_tz": "2023-09-01T11:03:15Z",
"myDate": "2023-09-01T11:03:15+0000",
"myFormat": "2023-09-01T11:03:15+0000"
} |
Thanks a lot for all these explanations and tips. This indeed fixes my problem until the date format issue is solved.
For the record yet, I could not have it work with v2-rc2: I had to revert both pluging (webhook and REST) to the 1.2.4 |
Yeah, sorry about that. The date tool is very new and I haven't released an updated 2.0.0: with it included yet. |
No need to be sorry :) |
Hmm. There are lots of interesting bug in this behaviour.
Result: Preview/test from the template editor does not support |
Hi,
First, thanks for the great job, it helps a lot! I yet have an issue while handling dates.
Expected Behavior
Start and End (retrieved with currentDate) timestamps should be displayed using iso format.
Current Behavior
Date are generated in the form of
8/31/23, 9:00 AM
, both in previews and in the payload that is sent to the webhook.Steps to Reproduce (for bugs)
I have also tried to get access to the dateTool object [1] without success.
Your Environment
Any hint would be greatly appreciated.
[1]: Seems like it has been added for 1.2.4 at least
The text was updated successfully, but these errors were encountered: