RevenueCat / purchases-android

Android in-app purchases and subscriptions made easy.
https://www.revenuecat.com/
MIT License
247 stars 50 forks source link

Package billingPeriod "value" incorrect: seems to be iso8601-1 instead of iso8601-2 #1753

Closed vegaro closed 3 months ago

vegaro commented 3 months ago

From https://community.revenuecat.com/sdks-51/package-billingperiod-value-incorrect-seems-to-be-iso8601-1-instead-of-iso8601-2-4655

I seem to be getting an incorrect value for my free trial billingPeriod on Android.

I thought it would be good to ask here whether I’m understanding this correctly and/or whether to open an issue on GitrHub.

I’ve set the trial period to 90 days in the Play Console, but in the returned package I’m getting 86 days. Looking at the iso8601 value, 84 days corresponds to 12 weeks so it looks like it’s ignoring the 6D. I’ve just learned that iso8601-1 doesn’t allow any other values if W(eeks) is specified but iso8601-2 does. It seems like, although P12W6D is correct (84 days + 6 days = 90 days) the ‘value’ field is showing an iso8601-1 interpretation (84 days only) rather than iso8601-2.

image


I created a simple test in our test suite and it looks like we are parsing P12W6D as 12 weeks (omitting the days). I am not sure how it's getting converted to 86 days in the screenshot since the Period.create("P12W6D") function is creating a 12 week Period, but in any case it should be creating a 90 days Period

RCGitBot commented 3 months ago

👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!

davidcarboni commented 3 months ago

Thanks @vegaro !

github-actions[bot] commented 3 months ago

This issue has been automatically locked due to no recent activity after it was closed. Please open a new issue for related reports.