StoreKit Test Receipts report the wrong timezone for expires

Originator:andy
Number:rdar://FB9085712 Date Originated:April 22, 2021
Status:Potential fix identified - For a future OS update Resolved:
Product:StoreKit Testing in Xcode Product Version:
Classification:Incorrect/Unexpected Behavior Reproducible:Yes
 
There’s some discussion about it here:
https://github.com/RevenueCat/purchases-ios/issues/491

The receipt generated by StoreKit Test has an incorrect value for timezone for expires_date. The date and time are correct, but they’re reported as UTC, and instead their values correspond to the user’s local time zone. 
So if you parse them to grant access to an IAP, if the user is in a timezone after UTC (i.e.: UTC +3), they’ll get 3 more hours of entitlement than they should, and if they’re in a timezone before UTC (i.e.: UTC -3), their purchases will have expired 3 hours before the real expiry date.

Here’s a sample: 

Receipt token: 

'MIAGCSqGSIb3DQEHAqCAMIACAQExDzANBglghkgBZQMEAgEFADCABgkqhkiG9w0BBwGggCSABIIBhzGCAYMwDwIBAAIBAQQHDAVYY29kZTALAgEBAgEBBAMCAQAwIgIBAgIBAQQaDBhjb20ucmV2ZW51ZWNhdC5zYW1wbGVhcHAwCwIBAwIBAQQDDAE0MBACAQQCAQEECPr/3/kLAAAAMBwCAQUCAQEEFLi8wi8iws5wgmsDvSwytXDm3mt8MAoCAQgCAQEEAhYAMCICAQwCAQEEGhYYMjAyMS0wNC0yMlQxNTo1OTo0OSswODAwMIGtAgERAgEBBIGkMYGhMAwCAgalAgEBBAMCAQEwMwICBqYCAQEEKgwoY29tLnJldmVudWVjYXQuYW5udWFsXzM5Ljk5LjJfd2Vla19pbnRybzAMAgIGpwIBAQQDDAEwMB8CAgaoAgEBBBYWFDIwMjEtMDQtMjJUMTU6NTk6NDlaMB8CAgasAgEBBBYWFDIwMjItMDQtMjJUMTU6NTk6NDlaMAwCAga3AgEBBAMCAQEwIgIBFQIBAQQaFhg0MDAxLTAxLTAxVDA4OjAwOjAwKzA4MDAAAAAAAACgggN4MIIDdDCCAlygAwIBAgIBATANBgkqhkiG9w0BAQsFADBfMREwDwYDVQQDDAhTdG9yZUtpdDERMA8GA1UECg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sGV0MFS+KD/WJyNcrHR7sK5EFpz1PMYIBjzCCAYsCAQEwZDBfMREwDwYDVQQDDAhTdG9yZUtpdDERMA8GA1UECgwIU3RvcmVLaXQxETAPBgNVBAsMCFN0b3JlS2l0MQswCQYDVQQGEwJVUzEXMBUGCSqGSIb3DQEJARYIU3RvcmVLaXQCAQEwDQYJYIZIAWUDBAIBBQAwDQYJKoZIhvcNAQELBQAEggEADo5feSemiKpOkewp/qNJq3T5OK+su2V6Ln7juUbrLjfZGAj/GorThGHmpWWViglnzn+bSvv+IAzJUV994gFRSo80JuNjjKwXVyC6ulFtwxomVdnBWhORB2b5pULprP9BLnnn45p8tVZS7nQeWVOpg37mgKWOtiTJYRz5aydIx0kRuWrM/x0cC9Fiu8BZC2CveFeUw/Z6GKdRkCRsZP2WgEN9qQLOiCiHs3W8Z5K3BFZkM9/G+Q1U+01z9Ft/r/meAs+ItD1wqzdWIT6I7i5kb9jCTofYftCOKl5SJsslPAfPKV/dEugiIJBdyjqJz0nBRnhxEhaIxpRbCQzg4HWzlQAAAAAAAA=='

When parsed, it produces: 

{
  "bundle_id": "com.revenuecat.sampleapp",
  "application_version": "4",
  "receipt_creation_date": "2021-04-22T15:59:49+0800",
  "expiration_date": "4001-01-01T08:00:00+0800",
  "in_app": [
    {
      "quantity": 1,
      "product_id": "com.revenuecat.annual_39.99.2_week_intro",
      "transaction_id": "0",
      "purchase_date": "2021-04-22T15:59:49Z",
      "expires_date": "2022-04-22T15:59:49Z",
      "is_in_intro_offer_period": 1
    }
  ],
}

Note that the timezone for the expires_date and purchase_date there is reported as UTC, but the value of the date itself is in the user’s timezone.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!