Skip to content
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

Product DateTime Deserialization Issue #462

Closed
pradeep0102 opened this issue May 7, 2020 · 6 comments
Closed

Product DateTime Deserialization Issue #462

pradeep0102 opened this issue May 7, 2020 · 6 comments

Comments

@pradeep0102
Copy link

pradeep0102 commented May 7, 2020

Make sure you have included the below details when open an issue. Thank you.

  • Wordpress version, WooCommerce version and WooCommerce.NET version
    Wordpress version : 5.4
    WooCommerce version : 4.0.1
    WooCommerce.NET : 0.8.2 and 0.7.9

  • Steps to replicate the issue
    I hate synced the products already. Now to update the changes on WooCommerce when trying to get the product then getting deserialization issue.

    Code :
    Task productTask = Task.Run(() => wc.Product.Get(item.WooCommerceId));
    productTask.Wait();
    var product = productTask.Result;

  • Details of the error message if there is any
    There was an error deserializing the object of type WooCommerceNET.WooCommerce.v3.Product. The DateTime represented by the string is not supported in calendar System.Globalization.GregorianCalendar.

at WooCommerceNET.RestAPI.DeserializeJSon[T](String jsonString)
at WooCommerceNET.Base.WCItem`1.d__9.MoveNext()

Due to this my live website is down. Please help me to get this resolved.

@XiaoFaye
Copy link
Owner

XiaoFaye commented May 7, 2020

Have you checked this #445 ?

@pradeep0102
Copy link
Author

I have created a service to sync the data so not able to set that.
This is the data I am getting from api -
image

Thanks.

@XiaoFaye
Copy link
Owner

XiaoFaye commented May 7, 2020

I think it has something to do with your server Calendar setting, but I don't know what changes you have done that cause this issue.

@pradeep0102
Copy link
Author

Yes.
It looks the date format issue is there on server side. This is fresh sync. I synced few days ago when no data was there. The it worked fine however now I want to update the details so it is giving issue.

For now I moved ahead by using workaround -

string trimstr(string json)
{
return json.Replace("0000-", "0001-");
}

@XiaoFaye
Copy link
Owner

XiaoFaye commented May 7, 2020

I see, that's a invalid date string, your solution should work fine.

@pradeep0102
Copy link
Author

Yes. It did.

Thanks for your help.

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

No branches or pull requests

2 participants