Example usage for java.time.temporal ChronoUnit HALF_DAYS

List of usage examples for java.time.temporal ChronoUnit HALF_DAYS

Introduction

In this page you can find the example usage for java.time.temporal ChronoUnit HALF_DAYS.

Prototype

ChronoUnit HALF_DAYS

To view the source code for java.time.temporal ChronoUnit HALF_DAYS.

Click Source Link

Document

Unit that represents the concept of half a day, as used in AM/PM.

Usage

From source file:alfio.manager.TicketReservationManager.java

public static ZonedDateTime getOfflinePaymentDeadline(Event event, ConfigurationManager configurationManager) {
    ZonedDateTime now = ZonedDateTime.now(event.getZoneId());
    int waitingPeriod = getOfflinePaymentWaitingPeriod(event, configurationManager);
    if (waitingPeriod == 0) {
        log.warn(/*w w  w.j  a  va2s. co  m*/
                "accepting offline payments the same day is a very bad practice and should be avoided. Please set cash payment as payment method next time");
        //if today is the event start date, then we add a couple of hours.
        //TODO Maybe should we avoid this wrong behavior upfront, in the admin area?
        return now.plusHours(2);
    }
    return now.plusDays(waitingPeriod).truncatedTo(ChronoUnit.HALF_DAYS);
}