Class F_PlainDate

java.lang.Object
com.ssgllc.fish.f.plaindate.F_PlainDate

public class F_PlainDate extends Object
A calendar date - no time, no zone - and the start of every f().date chain.

Continue through is to compare, elapsed to measure a distance, add or subtract to shift, and toIso() or format(String) to render.

  • Field Details

    • plainDate

      public LocalDate plainDate
      The underlying date, for handing to Java APIs that want a LocalDate.
    • is

      public F_PlainDate_Is is
      Comparisons: f().date.today().is.after("2026-01-01").
    • elapsed

      public F_PlainDate_Elapsed elapsed
      Distance to another date: f().date.today().elapsed.years.after(birthDate).
    • add

      public F_PlainDate_Add add
      Move forwards: f().date.today().add.days(30).
    • subtract

      public F_PlainDate_Add subtract
      Move backwards: f().date.today().subtract.months(6).
  • Constructor Details

    • F_PlainDate

      public F_PlainDate(LocalDate date)
  • Method Details

    • toIso

      public String toIso()
      The date as an ISO-8601 string, yyyy-MM-dd. This is also what the value serialises to in JSON, so it is the form to use when setting a field or building a payload.
      Returns:
      the date in ISO-8601

      Groovy example:
      f().date.today().toIso()

      Returns:
      "2026-08-21"

      SpEL example:
      #f().date.today().toIso()
    • format

      public String format(String pattern, String locale)
      The date formatted with a pattern in a given locale. The pattern is the JavaScript-style one the front end uses, so the same pattern renders identically on both sides.
      Parameters:
      pattern - the format pattern
      locale - a BCP 47 locale tag, e.g. "es-US"
      Returns:
      the formatted date

      Groovy example:
      f().date.today().format("MMMM d, yyyy", "es-US")

      Returns:
      "agosto 21, 2026"

      SpEL example:
      #f().date.today().format("MMMM d, yyyy", "es-US")
    • format

      public String format(String pattern)
      The date formatted with a pattern in the US locale. Use format(String, String) to choose a different locale.
      Parameters:
      pattern - the format pattern
      Returns:
      the formatted date

      Groovy example:
      f().date.today().format("MM/dd/yyyy")

      Returns:
      "08/21/2026"

      SpEL example:
      #f().date.today().format("MM/dd/yyyy")