Skip to content
This repository has been archived by the owner on Mar 20, 2018. It is now read-only.

Standard approach to adding larger units #70

Closed
jodastephen opened this issue Aug 24, 2012 · 1 comment
Closed

Standard approach to adding larger units #70

jodastephen opened this issue Aug 24, 2012 · 1 comment

Comments

@jodastephen
Copy link
Member

There needs to be consistency when adding a larger unit to an "incomplete" date-time object. For example, should you be able to add MONTHS to a LocalTime, or YEARS to DayOfWeek.

While being strict may seem like the obvious answer, it creates unreasonable boundaries:

JANUARY.plus(12, MONTHS)    \\ fine
JANUARY.plus(1, YEARS)      \\ ???
JANUARY.plus(2, CENTURIES)  \\ ???

MIDDAY.plus(24, HOURS)  \\ fine
MIDDAY.plus(1, DAYS)    \\ ???
MIDDAY.plus(2, WEEKS)   \\ ???
@jodastephen
Copy link
Member Author

Adopting approach that "boundary" unit is allowed, but not larger ones.

JANUARY.plus(12, MONTHS)    \\ fine
JANUARY.plus(1, YEARS)      \\ fine, no-op
JANUARY.plus(2, CENTURIES)  \\ error

MIDDAY.plus(24, HOURS)  \\ fine
MIDDAY.plus(1, DAYS)    \\ fine, no-op
MIDDAY.plus(2, WEEKS)   \\ error

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant