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

Bug report: dateformat(..., "MMM") shows Sept instead of Sep #2477

Open
dev027 opened this issue Nov 15, 2024 · 1 comment
Open

Bug report: dateformat(..., "MMM") shows Sept instead of Sep #2477

dev027 opened this issue Nov 15, 2024 · 1 comment
Labels
bug Something isn't working.

Comments

@dev027
Copy link

dev027 commented Nov 15, 2024

What happened?

I have two properties, called updated and created which are both dates. If I use the function dateformat(updated, "dd MMM yy") then for most dates it shows a three character month name, for example Jan, Feb, Mar

EXCECPT FOR September where it shows Sept instead of the expected Sep

DQL

table dateformat(updated, "dd MMM yy") as "Updated", dateformat(created, "dd MMM yy") as "Created"
from #🌾 
sort updated desc

JS

No response

Dataview Version

0.5.67

Obsidian Version

1.7.6

OS

Windows

@dev027 dev027 added the bug Something isn't working. label Nov 15, 2024
@BriLeeCar
Copy link

BriLeeCar commented Nov 17, 2024

From my understanding, the date functions are all built on top of luxon, which just pulls the local abbreviation.

https://moment.github.io/luxon/#/formatting?id=table-of-tokens

image

Not sure where you're from, but I believe at least the U.K., US, and Aus use Sept.

There's probably a more graceful way to do this, but if you want to guarantee 3 letters you could use

regexreplace(
    dateformat(file.cday, "dd MMM yy"),
    "(\d+) ([^ ]{0,3})[^ ]? (\d+)",
    "$1 $2 $3"
)

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