History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: QB-3721
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Robin Shen
Reporter: Robert Saladra
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
QuickBuild

Variable with "Prompt as Date Input" uses timezone, resulting in possible invalid date returned

Created: 31/May/21 10:22 AM   Updated: 01/Jun/21 03:07 PM
Component/s: None
Affects Version/s: 10.0.21
Fix Version/s: 11.0.3

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown


 Description  « Hide
I've used variable my_date with Prompt as Date Input setting, provided todays date (2021-05-31). Then I've tried to get that date in different format, using vars.get().asDate() and uitl.formatDate(), which gave me previous day instead of current. Minimal working example code below. It's clearly connected with user/instance timezone but I'd like to avoid hardcoding "add 1 day" wherever we use date variables.

groovy:
my_date = vars.get("my_date")
logger.info("To string: " + my_date.toString())
// To string: 2021-05-31 +0200

logger.info("Date with underscores: " + util.formatDate(my_date.asDate(), "yyyy_MM_dd"))
// Date with underscores: 2021_05_30

logger.info("Full datetime object: " + util.formatDate(my_date.asDate(), "yyyy-MM-dd, HH:mm:SS Z"))
// Full datetime object: 2021-05-30, 22:00:00 +0000

 All   Comments   Work Log   Change History      Sort Order:
No work has yet been logged on this issue.