-
-
Notifications
You must be signed in to change notification settings - Fork 983
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
Add helper method to convert from US week numbering #257
Comments
Any change to Joda-Time would involve a full global solution based on a |
Right, and the utility I implemented is literally a couple of static methods on a util class which take a calendar year, US week number and US weekday number, and return a Joda DateTime object. It does the job (although doesn't seem like a particularly Joda-ish API, I must admit). I haven't addressed the job of converting in the other direction yet, although. [It has now occurred to me that it might be more sensibly implemented as date-time format fields (by analogy with strftime/strptime, which in modern C implementations support for ISO and US week numbering), but I think that change would be further-reaching (and I have no idea of the implementation difficulty, but it's presumably going to be more than the few dozen LOC I've written in the linked implementation). It would also pollute the rest of the codebase with workarounds for these aberrant non-ISO date formats] |
For posterity, here's the API from over at my Gist
|
It would be great to have a method to convert from the US week numbering system (First weekday is Sunday, week 1 always starts on the first sunday, preceding days are in week 0) to a JodaTime object
I have written some code to do this but it would be great (for me, and I think others) to have it included in JodaTime. I've posted it under ASL at:
https://gist.github.com/admackin/8e9847c0f4f078ea8cd0
Could this be worked into something suitable for inclusion? I wanted to check if a) it was worth adapting it for inclusion and b) what I would need to do, before opening a pull request. (Obviously I would convert the asserts into proper standalone unit tests, but I'm not sure what else would make sense)
The text was updated successfully, but these errors were encountered: