Example usage for org.joda.time YearMonth fromDateFields

List of usage examples for org.joda.time YearMonth fromDateFields

Introduction

In this page you can find the example usage for org.joda.time YearMonth fromDateFields.

Prototype

@SuppressWarnings("deprecation")
public static YearMonth fromDateFields(Date date) 

Source Link

Document

Constructs a YearMonth from a java.util.Date using exactly the same field values avoiding any time zone effects.

Usage

From source file:com.court.handler.FxUtilsHandler.java

public static Predicate<MemberLoan> checkIfNotYetPaid(Function<MemberLoan, Date> check_date) {
    DateTimeZone zone = DateTimeZone.forID("Asia/Colombo");
    YearMonth ym_now = YearMonth.now(zone);

    return t -> {
        YearMonth ym_last = YearMonth.fromDateFields(new DateTime(check_date.apply(t), zone).toDate());
        //            if (t.getId() == 206) {
        //                YearMonth lastPaid = YearMonth.fromDateFields(new DateTime(check_date.apply(t), zone).toDate());
        //                System.out.println(ym_now.isAfter(lastPaid) || ym_now.isEqual(lastPaid));
        //                System.exit(0);
        //            }
        boolean flag = check_date.apply(t) != null
                ? (t.isContinuousPay() ? true : (ym_now.isAfter(ym_last) || ym_now.isEqual(ym_last)))
                : true;/*from w  ww. jav  a 2s  .c  o m*/
        // boolean flag = check_date.apply(t) != null ? (ym_now.isAfter(ym_last) || ym_now.isEqual(ym_last)) : true;
        return flag;
    };
}