=== Date intervals

:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
:page-partial:


The xref:refguide:applib:index/annotation/PropertyLayout.adoc#renderDay[renderDay()] element applies only to date properties whereby the date will be rendered as the day before the value actually held in the domain object.
It is ignored for properties of other types.

This behaviour might at first glance appear odd, but the rationale is to support the use case of a sequence of instances that represent adjacent intervals of time.
In such cases there would typically be `startDate` and `endDate` properties, eg for all of Q2. Storing this as a half-closed interval -- eg `[1-Apr-2015, 1-July-2015)` -- can substantially simplify internal algorithms; the `endDate` of one interval will correspond to the `startDate` of the next.

However, from an end-user perspective the requirement may be to render the interval as a fully closed interval; eg the end date should be shown as `30-Jun-2015`.

This attribute therefore bridges the gap; it presents the information in a way that makes sense to an end-user, but also stores the domain object in a way that is easy work with internally.

For example:

[source,java]
----
import lombok.Getter;
import lombok.Setter;

public class Tenancy {

    @Getter @Setter
    private LocalDate startDate;

    @PropertyLayout(
        renderDay = RenderDay.AS_DAY_BEFORE
    )
    @Getter @Setter
    private LocalDate endDate;

    // ...
}
----


