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

Documentation for toString() date format codes is incorrect #376

Open
pumalife opened this issue Sep 16, 2024 · 5 comments
Open

Documentation for toString() date format codes is incorrect #376

pumalife opened this issue Sep 16, 2024 · 5 comments
Assignees
Labels
documentation About the user manual or technical documentation Good First Issue Indicates issues suitable for newcomers to design or coding, providing a gentle introduction.

Comments

@pumalife
Copy link

value: 2024-01-17T00:00:00Z
value.toString('u')
should return the day number for the current week ( ie 1-7) as indicated in https://openrefine.org/docs/manual/grelfunctions#date-functions

but its returning 2024
ive tried this with a text value and converted it to date, manually specifying the format date text value. ie value.toDate('y/m/d').toString('u') and it still outputs 2024

@tfmorris
Copy link
Member

The documentation is incorrect. You can find the correct field letters here: https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html

The reference to https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html is outdated, but we generally try to preserve compatibility, so I'm not sure what other incompatibilities are lurking here.

@tfmorris
Copy link
Member

I went through the two pages and I think these are the differences

Old (SimpleDateFormat) New (DateTimeFormatter) Meaning Comment
y u Year y = year of era, which will be the same in most cases
F [none]? Day of week in month no equivalent?
u e Day of week e is actually "localized day of week"

@tfmorris tfmorris transferred this issue from OpenRefine/OpenRefine Sep 17, 2024
@tfmorris tfmorris changed the title Date function 'u' Day Num in week, returning year Documentation for toString() date format codes is incorrect Sep 17, 2024
@thadguidry thadguidry added documentation About the user manual or technical documentation Good First Issue Indicates issues suitable for newcomers to design or coding, providing a gentle introduction. labels Sep 18, 2024
@SymbolofMoon
Copy link

Hi @tfmorris ,

I have gone through the docs and found out that
E returns the day in Text (i.e in Tuesday) and e returns the number of week (2)

You can check the below screenshot.

screenshot-docs_oracle_com-2024_11_15-01_23_36

Also please let me know if the issue is open for contribution

@mynk2611
Copy link
Contributor

hello @tfmorris @thadguidry , i have solved this issue in PR #402

@thadguidry
Copy link
Member

I'll have to defer to Tom on this particular issue, so that we get it 100% correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation About the user manual or technical documentation Good First Issue Indicates issues suitable for newcomers to design or coding, providing a gentle introduction.
Projects
None yet
Development

No branches or pull requests

5 participants