Better way to get release date from Google Play
codeback opened this issue ยท 9 comments
Thanks for this amazing plugin.
I have problems getting the release date. Depending of the country code I'm getting the date in different formats:
https://play.google.com/store/apps/details?id=com.bitstrips.imoji&hl=en
November 22, 2017
https://play.google.com/store/apps/details?id=com.bitstrips.imoji&hl=es
22 de noviembre de 2017
In both cases I'm getting NaN in the line 134 of store-update.common.js file:
// releaseDate = '22 de noviembre de 2017 or 'November 22, 2017'
var daysSinceRelease = moment().diff(moment(new Date(releaseDate)), 'days');
The problem is that the confirm dialog is never shown.
Is there a way to get this date in an ISO format (and independent of the country code)?
Thanks in advance.
Hi @codeback,
Mm, in fact, it's something needing a fix. Moment should be used to convert the string to a common format. If you want to create a PR for this, feel free. Otherwise, we'll investigate it as soon as we have a moment. Thank you for the heads up!
Hi @SBats,
Thank you for your response. The problem is that it is difficult to parse the string because this string will be different depending on the country code.
A possible solution would be to make this request always in 'en'. This way we would get the date always in the same format (November 22, 2017) and we could then parse to a date with Moment.
Is there a reason to get the market info with the localized info?
Please tell me if the proposed solution would be valid. If it is, I'll make a pull request with the changes.
Mm I'm not sure but I think an app can be published in only selected store (for example published in es
but not in en
). So always using en
could cause an issue if the person hasn't published it in this language.
On another hand, Moment is Supposed to handle a lot of locale so I think it could parse a full text version, as long as we specify the format as second parameter.
Those are hypothesis though, I need to check.
Hi @codeback,
The country code is indeed setup because not everyone publish everytime on every store.
For instance you may wanna do a panel testing on a specific country before releasing to the entire world.
Other case: you may be a Portuguese company that will only release your app in Portugal (thus en
default lang will never return a valid version)
Yes I think you are right, but I don't know if it is done with the hl param (like it is in the code).
I have an app published in Spain only and I can access it with hl=fr, for example.
Can you check if you can access?
Yes I can access it.
If you have a single store to manage or deploy to all the stores in the same time, there's no real issue as you can set the locale you want.
@jeremypele, I'm not sure If I've understood correctly. Then the proposed solution (hl=en) would be valid?
If we can find a solution of getting always the same format, the Moment dependency could be removed since it is only used in that line, and we would save a few bytes ;)
Hi @SBats and @jeremypele, I've just tested it on iOS.
While in Android I can access to the Google Play info independently of the country code, in iOS you can't if the app is published in a country (as you said). So, I don't know a good way to do this, since I have two problems now :(
- To get the correct url: A person in Spain can have the mobile settings in 'fr'. The built url would be with the param 'fr' and I haven't published the app in France.
- To correctly parse the date. It seems to me a minor problem compared with the aforementioned :)
Ohh, I think there is a bug in the way the url is built in iOS. It should be https://itunes.apple.com/{{countrycode}}/lookup?bundleId={{bundleId}}
-
Mm. We might have to add a list of available store languages in the plugin options as well as a default in case the phone lang is not in it.
-
As for the parsing, I've tested it and can confirm moment can do with locale aware parsing.
Example:
es ->moment('22 de noviembre de 2017', 'LL', 'es')
en ->moment('November 22, 2017', 'LL', 'en')
They both giveWed Nov 22 2017 00:00:00 GMT-0500 (EST)
For the Apple store URL, I'll check, thanks for the heads up.