Module: tastypie/fields/datetime

Field class for dealing with Date Time objects


new (require("tastypie/fields/datetime"))( [options])

Extends:
Parameters:
Name Type Argument Description
options Object <optional>
Properties
Name Type Argument Default Description
format String <optional>
%Y-%m-%dT%M:%H:%S.%LZ
Source:

Requires

  • module:boom
  • module:util
  • module:mout/date/strftime
  • module:mout/lang/isString
  • module:tastypie/lib/class
  • module:tastypie/lib/fields/api

Methods


<protected> augment(resource, name)

Injects dynamic properties onto field instance for later use

Parameters:
Name Type Description
resource Resource

the resource instance this field is attached to

name String

The property name this field is associated to

Inherited From:
Source:

convert(val)

Converts data value into the serialization specific type.

Parameters:
Name Type Description
val Mixed

value to convert

Inherited From:
Source:
Returns:

value The converted field value

Type
Mixed

dehydrate(object, attribute)

Converts a javascript object / value into something sutable for seriaation. ex. Date formatting

Parameters:
Name Type Description
object Object

Object to dehydrate before serialization

attribute Sting | function

a name path or function to use to retrieve a value from the object

Inherited From:
Source:
Returns:

value object value converted to its internal type

Type
Mixed

format()

returns a sample of the format expected and returned by a field

Inherited From:
Source:
Returns:

The format expected for a particular field type

Type
String | undefined

hydrate(bundle)

Converts a serialized value in to a javascript object value

Parameters:
Name Type Description
bundle Bundle

a bundle representing the current request

Inherited From:
Source: