Package com.smartgwt.client.types

# Enum JSONDateFormat

java.lang.Object
java.lang.Enum<JSONDateFormat>
com.smartgwt.client.types.JSONDateFormat

All Implemented Interfaces:
  `ValueEnum`, `Serializable`, `Comparable<JSONDateFormat>`, `Constable`

public enum JSONDateFormat extends Enum<JSONDateFormat> implements ValueEnum
Format for encoding dates in JSON. Note you can override `JSONEncoder.encodeDate()` for a custom format.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class java.lang.Enum

  `Enum.EnumDesc<E extends Enum<E>>`

- ## Enum Constant Summary

  Enum Constants
  Enum Constant
  Description
  `DATE_CONSTRUCTOR`
  dates are encoded as raw JavaScript code for creating a Date object, that is:
  `LOGICAL_DATE_CONSTRUCTOR`
  serializes Date instances in a way that preserves the distinction between logical dates, logical times, and full datetime values, as explained `here`.
  `LOGICAL_DATE_STRING`
  Dates are encoded as strings in a format that `JSON.decodeSafeWithDates()` will recognize.
  `XML_SCHEMA`
  dates are encoded as a String in XML Schema date format in UTC, for example, "2005-08-02" for logical date fields or "2005-08-01T21:35:48.350" for `datetime` fields.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getValue()`
  `static JSONDateFormat`
  `valueOf(String name)`
  Returns the enum constant of this type with the specified name.
  `static JSONDateFormat[]`
  `values()`
  Returns an array containing the constants of this enum type, in the order they are declared.

  ### Methods inherited from class java.lang.Enum

  `clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

  ### Methods inherited from class java.lang.Object

  `getClass, notify, notifyAll, wait, wait, wait`

- ## Enum Constant Details

  - ### XML_SCHEMA

    public static final JSONDateFormat XML_SCHEMA
    dates are encoded as a String in XML Schema date format in UTC, for example, "2005-08-02" for logical date fields or "2005-08-01T21:35:48.350" for `datetime` fields. See `Date format and\n storage` for more information.
    Note.If JSON containing xmlSchema-formatted date values is passed to `JSON.decodeSafe()` or `JSON.decodeSafeWithDates()`, these formatted date values will not be converted to actual date objects in the generated JavaScript object. Use "logicalDateString" instead.

    If this enumerated value is used in a `Component XML` file or server-side DataSource descriptor (.ds.xml file), use the value "xmlSchema".

  - ### DATE_CONSTRUCTOR

    public static final JSONDateFormat DATE_CONSTRUCTOR
    dates are encoded as raw JavaScript code for creating a Date object, that is:

          new Date(1238792738633)

    This is not strictly valid JSON, but if eval()d, will result in an identical date object, regardless of timezone. However, it does not preserve the distinction between logical dates vs full datetime values - use "logicalDateConstructor" mode for that.
    Note.This format does not work with `JSON.decodeSafe()`. If you need to use `JSON.decodeSafe()` and/or `JSON.decodeSafeWithDates()`, you will need to use "logicalDateString" instead.

    If this enumerated value is used in a `Component XML` file or server-side DataSource descriptor (.ds.xml file), use the value "dateConstructor".

  - ### LOGICAL_DATE_CONSTRUCTOR

    public static final JSONDateFormat LOGICAL_DATE_CONSTRUCTOR
    serializes Date instances in a way that preserves the distinction between logical dates, logical times, and full datetime values, as explained `here`. Like 'dateConstructor' mode, this does not produce strictly valid JSON, and instead embeds JavaScript calls.

    In addition, unlike 'dateConstructor' mode, using eval() to reconstruct the original JavaScript objects will only work in the presence of Smart GWT, and not just in a generic JavaScript interpreter.
    Note.This format does not work with `JSON.decodeSafe()`. If you need to use `JSON.decodeSafe()` and/or `JSON.decodeSafeWithDates()`, you will need to use "logicalDateString" instead.

    If this enumerated value is used in a `Component XML` file or server-side DataSource descriptor (.ds.xml file), use the value "logicalDateConstructor".

  - ### LOGICAL_DATE_STRING

    public static final JSONDateFormat LOGICAL_DATE_STRING
    Dates are encoded as strings in a format that `JSON.decodeSafeWithDates()` will recognize. This allows developers to round-trip date, time and datetime values to and from strict JSON.

    If this enumerated value is used in a `Component XML` file or server-side DataSource descriptor (.ds.xml file), use the value "logicalDateString".

- ## Method Details

  - ### values

    public static JSONDateFormat[] values()
    Returns an array containing the constants of this enum type, in the order they are declared.
    Returns:
      an array containing the constants of this enum type, in the order they are declared

  - ### valueOf

    public static JSONDateFormat valueOf(String name)
    Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
    Parameters:
      `name` - the name of the enum constant to be returned.
    Returns:
      the enum constant with the specified name
    Throws:
      `IllegalArgumentException` - if this enum type has no constant with the specified name
      `NullPointerException` - if the argument is null

  - ### getValue

    public String getValue()
    Specified by:
      `getValue` in interface `ValueEnum`