You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have a use case where we need a type-safe way of representing a localized week in an application. That object is pretty much the same of YearWeek, except that the first day and the minimal number of days varies.
Is there support for implementing such temporal?
I thought initially to implement a LocalizedYearWeek, with some factory methods such as LocalizedYearWeek.of(int year, int week, WeekDefinition weekDefinition). The class WeekDefinition is merely a value object that defines the first day and the minimal number of days of a week, that can also work as a factory of WeekFields.
Introducing a WeekDefinitionQuery would provide an interoperability layer between week objects, e.g. YearWeek.from(LocalizedYearWeek.of(2018, 1, WeekDefinition.ISO)) or LocalizedYearWeek.from(YearWeek.of(2018, 1)).
I would be happy to provide a PR if welcome.
The text was updated successfully, but these errors were encountered:
It seems reasonable to add a LocalizedYearWeek class, partly as I don't see any other way to do it. I don't see the need for a WeekDefinition though, just pass in an instance of WeekFields.
I'm not sure how you could convert between instances of year-week classes without a date. You'd have to decide how the weeks align, which I don't think you can reasonably do (unless both follow ISO week rules).
We have a use case where we need a type-safe way of representing a localized week in an application. That object is pretty much the same of
YearWeek
, except that the first day and the minimal number of days varies.Is there support for implementing such temporal?
I thought initially to implement a
LocalizedYearWeek
, with some factory methods such asLocalizedYearWeek.of(int year, int week, WeekDefinition weekDefinition)
. The classWeekDefinition
is merely a value object that defines the first day and the minimal number of days of a week, that can also work as a factory ofWeekFields
.Introducing a
WeekDefinitionQuery
would provide an interoperability layer between week objects, e.g.YearWeek.from(LocalizedYearWeek.of(2018, 1, WeekDefinition.ISO))
orLocalizedYearWeek.from(YearWeek.of(2018, 1))
.I would be happy to provide a PR if welcome.
The text was updated successfully, but these errors were encountered: