Parsed datetime always contains timezone in the parsed value

Issue #1085 wontfix
Daniel Mallorga created an issue

Working with Liquibase when we we have something like this:

- column:
                name: created_at
                value: 2018-03-09 08:41:31.000

when this value is parsed as I live in ARG I get a value like this:

'Fri Mar 09 05:41:31 ART 2018' 

But we don’t need this value to contain a specific timezone on it.

Looking into the code we found this is because we are always returning return calendar.getTime(); at the end of construct(Node node) from ConstructYamlTimestamp class.

If we do these updates (starting on L445):

 TimeZone timeZone = null;
        if (timezoneh_s != null) {
          String time = timezonem_s != null ? ":" + timezonem_s : "00";
          timeZone = TimeZone.getTimeZone("GMT" + timezoneh_s + time);
          calendar = Calendar.getInstance(timeZone);
          ;
        } else {
          calendar = Calendar.getInstance();
        }

and

if (timeZone == null) {
          return new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(calendar.getTime());
        } else {
          return calendar.getTime();
        }

at the end, the issue is gone for us.

Could you please consider adding these changes to the ConstructYamlTimestamp class?

Thanks in advance,

Daniel.

Comments (5)

  1. Andrey Somov

    I tried your change. Unfortunately, it caused many test failures.

    Please provide a PR with the green tests

  2. Log in to comment