faker icon indicating copy to clipboard operation
faker copied to clipboard

Docs improvement for timezone

Open murraymichal opened this issue 2 years ago • 5 comments

In documentation, please refer to standard you are using for generating timezones. E.g. Asia/Rangoon is not an official IANA code, but is a "symlink" to Asia/Yangon. Thanks

murraymichal avatar Mar 30 '22 10:03 murraymichal

Could you please add a reference to the offending method/page in your future issues?

I assume you are referring to https://fakerjs.dev/api/address.html#timeZone Which uses a randomly chosen timezone. https://github.com/faker-js/faker/search?q=Asia%2FRangoon&type=

The documentation has been regenerated since and now uses a different timezone.

So we only have to decide whether the method should return any timezone (official + aliases) or just official ones.

ST-DDT avatar Mar 30 '22 11:03 ST-DDT

Yes. The same thing goes for the country name. We are using ISO-3166 names and faker is apparently using something different (possibly official UN names?). Please look at Korea as an example

ISO: Korea (the Democratic People's Republic Of) - faker/UN: Democratic People's Republic of Korea (as short and formal) ISO: Korea (the Republic Of) - faker/UN: Republic of Korea (as short and formal)

murraymichal avatar Mar 30 '22 12:03 murraymichal

Thanks for bringing this to our attention. We havent really touched these files since we took faker over. We will probably update these files in v6.2 (soon) along with the other locale files. For now, we are focussing on some remaining technical bugs for 6.1.x.


Here some node packages that we could use as external sources, other suggestions are welcome: Timezone: https://www.npmjs.com/package/tzdata Country code: https://www.npmjs.com/package/country-codes-list

ST-DDT avatar Mar 30 '22 12:03 ST-DDT

Our app is also running into this issue.

When a test user is seeded with a symlink time zone and not a 'real' time zone, various timing functionality in the app breaks because, in our case, Luxon doesn't operate as expected when passed a non-IANA time zone name.

To access IANA timezones we use:

import { rawTimeZones, RawTimeZone /* For Typescript */ } from '@vvo/tzdb';

sir-dunxalot avatar May 12 '22 18:05 sir-dunxalot

Team decision

use only official ones. Extract locales from en,... and move to global/method scope.

ST-DDT avatar Sep 08 '22 16:09 ST-DDT