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.
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 classWeekDefinitionis 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
WeekDefinitionQuerywould 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.