Reputation: 29
I am new to Youtrack Workflow. I am trying to create a new workflow for which I require hours from the current date-time.
I am using new Date().getHours()
but it's not returning proper value.
say for example my current time is Fri Jun 12 2020 18:29:29 GMT+0530 (India Standard Time)
then it should have got 18 as the current hour but, I am getting 12 as the current hour.
Also in the date-time function in Youtrack, there is no option for the same (https://www.jetbrains.com/help/youtrack/incloud/v1-date-time.html)
Please help me with this.
Upvotes: 0
Views: 737
Reputation: 281
As of now, new Date().getHours(
returns the time from the server Youtrack runs on. For example, if you run it on your own server (Standalone version), it returns the time set in your server's OS. If you run it on a Youtrack server (Incloud version), it returns the time set in our server's OS. If the server's OS fails to return the time, we fall back to the UTC time.
That's not a transparent behavior and is going to be addressed in this task in: https://youtrack.jetbrains.com/issue/JT-57972 In this task, we want to change it so that the time is returned based on your Youtrack settings. You can watch the issue to get notified of the changes made there. How to do it: https://take.ms/L0k8g (screenshot).
For now, though, if you use your own server, you can try to change the time there. Otherwise, I suggest that you get time in UTC using Date.getUTCHours()
and then add constant hours to get your local time.
Upvotes: 1