Class FormDate

  • public class FormDate
    extends Object
    Represents a date value submiited in a form.
    • Constructor Detail

      • FormDate

        public FormDate​(String isoString,
                        Locale locale)
        Creating a form date should involve the locale of the form and the ISO string (ISO-8601), yyyy-MM-dd.
        isoString - the ISO-8601 string representing the date
        locale - locale of the form scope, the ISO date will get formatted to this locale. The Locale should include a country and language tag.
    • Method Detail

      • toLocaleString

        public String toLocaleString​(Locale locale)
        Format the ISO string to some locale specified by the parameter
        locale - the locale to format the internal ISO string to
        String representing date formatted to the argument locale
      • getIsoFormat

        public String getIsoFormat()
        Get the ISO representation.
        String representing internal ISO String.
      • createProperLocale

        public static Locale createProperLocale​(String formLocaleString)
        formLocaleString - the String of the form scope representing the locale in the format: "language_COUNTRY" ("en_US")
        Locale with proper fields, both country tag and language tag
      • validIsoDate

        public boolean validIsoDate()
        Check whether the String supplied to the constructor is of format 'yyyy-MM-dd'. Should always be true since internal representations are ISO Strings.
        boolean indicating a valid internal ISO String
      • toString

        public String toString()
        toString method should return the formatted String as defined by the locale of the form. This method is called when accessing the value of the object in the Form scope.
        toString in class Object
        String representing date formatted to submitted locale from toSubmittedLocaleString().