Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error aplicando consulta en línea con dateformat #2501

Open
jrodri65 opened this issue Jan 8, 2025 · 1 comment
Open

Error aplicando consulta en línea con dateformat #2501

jrodri65 opened this issue Jan 8, 2025 · 1 comment
Labels
bug Something isn't working.

Comments

@jrodri65
Copy link

jrodri65 commented Jan 8, 2025

What happened?

Tengo en obsidian la propiedad tipo fecha llamada fechabautismo. En una nota dicha propiedad tiene un valor de 1896-01-21, Cuando hago la consulta en línea =dateformat(this.fechabautismo, "DDD") me devuelve 20 de enero de 1896.
Sin embargo si aplico la consulta en línea =dateformat(this.fechabautismo, "dd-MM-yyyy") me devuelve 21-01-1896
Además, en la misma nota hay otra propiedad tipo fecha llamada fechafallecimiento y si le aplico la consulta =dateformat(date(this.fechafallecimiento), "DDD") me devuelve bien el resultado.
El problema se soluciona añadiendo T00:00:00Z, quedando así: =dateformat(date(this.fechabautismo + "T00:00:00Z"), "DDD"). De esta forma sí devuelve el valor correcto: 21 de enero de 1896.

DQL

=dateformat(this.fechabautismo, "DDD")

JS

No response

Dataview Version

0.5.67

Obsidian Version

1.7.7

OS

Windows

@jrodri65 jrodri65 added the bug Something isn't working. label Jan 8, 2025
@holroy
Copy link
Contributor

holroy commented Jan 23, 2025

I don't know Spanish, so I've used Google translate. It seems like this could be related to which locale you're doing the query in. When using the DDD format it relies on correct locale information, but when using dd-MM-yyyy you're only using the numbers within the date. This is an educated guess from me.

You might get the correct result if you do `=dateformat(striptime(this.fechabautismo), "DDD"))`, as it then should remove the time part of the date.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working.
Projects
None yet
Development

No branches or pull requests

2 participants