Link Search Menu Expand Document

DateTime Field

Table of contents

  1. Example Usage
  2. Allowed Attributes
    1. Default
    2. Required
    3. Custom Name
    4. Auto
    5. Example Usage

Example Usage

const {Model, Field} = require("fireo");

class User extends Model{
    created = Field.DateTime();
}

const u = User.init();
u.created = new Date();

Allowed Attributes

The following attributes supported by Boolean Field.

  1. default
  2. required
  3. name
  4. auto
  • Default

    Default value for field. This is base attribute that is available in all fields. Read More

  • Required

    Set true if value is required for the field. This is base attribute that is available in all fields. Read More

  • Custom Name

    Set different name in Firestore instead of field name. This is base attribute that is available in all fields. Read More

  • Auto

Set the auto date if no value is provided

Example Usage

const {Model, Field} = require("fireo");

class User extends Model{
    created = Field.DateTime({auto: true});
}

const u = User.init();
u.save()
console.log(u.created)

Copyright © 2019 FireO All rights reserved. Powered by OctaByte