PopulateTools / gobierto

Plataforma de gobierno abierto open source
https://gobierto.es
GNU Affero General Public License v3.0
74 stars 32 forks source link

Data / Perspective doesn't format local dates #3812

Open Crashillo opened 3 years ago

Crashillo commented 3 years ago

It displays american-style format instead:

https://getafe.gobify.net/datos/habitantes-nacionalidad-nivel-instruccion/editor?sql=SELECT%2520%2a%2520FROM%2520habitantes_por_nacionalidad_nivel_instruccion%250Awhere%2520fecha%2520%253D%2520%271%252F4%252F2021%27

UPDATE

After a further research, we couldn't find a way to cast properly the locale-sensitive fields. These are date and decimal, mainly.

When perspective receives a csv-string as data input, it parses the fields by some built-in lib. It doesn't matter you explicitly set the datatypes, it does it anyways. As a result, dates and numeric values are shown in American format.

Another try was to send a javascript object, instead of a csv-string. That requires preparsed the datatypes, but even so, perspective casts the types again, resulting American format. The only way to bypass this is about converting (in the preparsed step) these fields to strings.

Crashillo commented 3 years ago

Regarding this: https://github.com/finos/perspective/issues/962