{"id":30389,"date":"2020-10-08T16:16:19","date_gmt":"2020-10-08T20:16:19","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=30389"},"modified":"2023-05-29T10:16:40","modified_gmt":"2023-05-29T14:16:40","slug":"date-format-change-in-app-store-receipts","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2020\/10\/08\/date-format-change-in-app-store-receipts\/","title":{"rendered":"Date Format Change in App Store Receipts"},"content":{"rendered":"<p><a href=\"https:\/\/twitter.com\/depth42\/status\/1314179654811607041\">Frank Illenberger<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/depth42\/status\/1314179654811607041\"><p>After some sweat and tears we have found the reason for the installation failures in the Mac App Store:\nAt some point in the last weeks, Apple has changed the format of the date values in its ASN.1 receipt files.<\/p><p>They used to look like &ldquo;2020-10-03T07:12:34Z&rdquo;. Now they added millisceonds like in &ldquo;2020-10-03T07:12:34.567Z&rdquo;. Apple&rsquo;s specification only states that dates follow RFC 3339, which does not specify if there should be milliseconds or not.<\/p><p>[&#8230;]<\/p><p>To make it even harder, Apple still sends out receipts containing dates WITHOUT milliseconds if an app has been originally bought before October.<\/p><\/blockquote>\n\n<p><a href=\"https:\/\/twitter.com\/danielpunkass\/status\/1314242861169336321\">Daniel Jalkut<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/danielpunkass\/status\/1314242861169336321\">\n<p>More on this: as far as I can tell the documented IAP dates are still returning dates that don&rsquo;t have milliseconds. I don&rsquo;t think there is a <em>documented<\/em> date field for Mac App Store receipts for the main app, as installed in the app binary.<\/p>\n<\/blockquote>\n<blockquote cite=\"https:\/\/twitter.com\/danielpunkass\/status\/1314244260040974337\"><p>These are the documented fields for <a href=\"https:\/\/developer.apple.com\/library\/archive\/releasenotes\/General\/ValidateAppStoreReceipt\/Chapters\/ReceiptFields.html\">local (on a Mac) receipt validation<\/a>.<\/p>\n<p>For server side receipt validation, there are <a href=\"https:\/\/developer.apple.com\/documentation\/appstorereceipts\/responsebody\/latest_receipt_info\">host of other fields<\/a>, including one that exposes the original purchase date in timestamp format.<\/p><\/blockquote>\n\n<p><a href=\"https:\/\/twitter.com\/rosyna\/status\/1314250914220269569\">Rosyna Keller<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/rosyna\/status\/1314250914220269569\"><p>The dates on the receipt documentation pages all mention they&rsquo;re in ISO 8601, so you&rsquo;d want to use that data formatter to read them instead of specifying an entirely manual, hand-crafted format string.<\/p><\/blockquote>\n\n<p>Hilariously, the documentation only promises that the date format will be &ldquo;similar to the ISO 8601.&rdquo;<\/p>\n\n<p><a href=\"https:\/\/twitter.com\/Padraig\/status\/1314259467270123520\">P&aacute;draig Kennedy<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/Padraig\/status\/1314259467270123520\"><p>A base ISO8601DateFormatter will parse the non-ms version only. To avoid this issue, devs would have to make two date parsers and try them one after another.<\/p><\/blockquote>\n\n<p><a href=\"https:\/\/twitter.com\/danielpunkass\/status\/1314281269681848324\">Daniel Jalkut<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/danielpunkass\/status\/1314281269681848324\"><p>If anybody thinks ISO8601 datetime strings are a well-defined format, here&rsquo;s the code in \n@MarsEdit\n that handles ISO8601 dates from various blogging platforms.<\/p><\/blockquote>\n\n<p>Previously:<\/p>\n<ul>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2019\/10\/16\/receipt-validation-and-airplay-2\/\">Receipt Validation and AirPlay 2<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2018\/03\/19\/app-store-certificate-checker-framework\/\">App Store Certificate Checker Framework<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2017\/07\/28\/receipt-validation-in-swift\/\">Receipt Validation in Swift<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2013\/10\/18\/modern-receipt-validation\/\">Modern Receipt Validation<\/a><\/li>\n<\/ul>","protected":false},"excerpt":{"rendered":"<p>Frank Illenberger: After some sweat and tears we have found the reason for the installation failures in the Mac App Store: At some point in the last weeks, Apple has changed the format of the date values in its ASN.1 receipt files.They used to look like &ldquo;2020-10-03T07:12:34Z&rdquo;. Now they added millisceonds like in &ldquo;2020-10-03T07:12:34.567Z&rdquo;. Apple&rsquo;s [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2020-10-08T20:16:22Z","apple_news_api_id":"a770e9fc-46ed-4c68-aed7-455c98d65be6","apple_news_api_modified_at":"2023-05-29T14:16:43Z","apple_news_api_revision":"AAAAAAAAAAAAAAAAAAAAAA==","apple_news_api_share_url":"https:\/\/apple.news\/Ap3Dp_EbtTGiu10VcmNZb5g","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[91,2392,522,31,1837,30,39,1666,568,71],"class_list":["post-30389","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-appstore","tag-app-store-receipt-validation","tag-inapppurchase","tag-ios","tag-ios-14","tag-mac","tag-macappstore","tag-macos-10-15","tag-nsdateformatter","tag-programming"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/30389","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=30389"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/30389\/revisions"}],"predecessor-version":[{"id":30390,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/30389\/revisions\/30390"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=30389"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=30389"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=30389"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}