Skip to content

Product creationDate returns current timestamp instead of actual creation date #773

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

Closed
lorenzOliveto opened this issue Feb 25, 2025 · 2 comments · Fixed by #781
Closed

Comments

@lorenzOliveto
Copy link
Contributor

lorenzOliveto commented Feb 25, 2025

I've updated the SDK to v2025.1.0 and noticed that the creationDate parameter returns the current timestamp rather than the actual creation date of the product.
After downgrading to version 18.1.0 and using the Joda DateTime object, the correct creation date is returned as expected.

I think that the problem is in the format used in this file.

@Jeel7584
Copy link

Jeel7584 commented Apr 3, 2025

Yes getting same issue, upon debugging

final class Utils {
  private static final SimpleDateFormat DATE_TIME_FORMATTER = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.US);

  static Date parseDateTime(String dateTime) {
      try {
          return DATE_TIME_FORMATTER.parse(dateTime);
      } catch (ParseException e) {
          return new Date();
      }
  }
}

This function is not able to parse the date correctly thats why its returning current date from catch block

@kieran-osgood-shopify
Copy link
Contributor

Hey all - apologies for the delay in getting to this, and appreciate you tracing through the issue
I've pushed a PR which I'll look to get reviewed now - hopefully it will fix this issue for you, check out the branch in #781 if you wish to test it out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants