import { Component, h, Host, Prop } from '@stencil/core';
import moment from 'moment';
import { DateDataType } from '../date';
export class DvnFieldDisplayDate {
  render() {
    let date = this.value;
    if (this.field.dateDataType === DateDataType.Unix) {
      date = new Date(this.value * 1000);
    }
    return (h(Host, null, this.value ? moment(date).format(this.field.dateFormat) : '-'));
  }
  static get is() { return "dvn-field-display-date"; }
  static get encapsulation() { return "scoped"; }
  static get originalStyleUrls() { return {
    "$": ["dvn-field-display-date.css"]
  }; }
  static get styleUrls() { return {
    "$": ["dvn-field-display-date.css"]
  }; }
  static get properties() { return {
    "value": {
      "type": "any",
      "mutable": false,
      "complexType": {
        "original": "number | string | Date",
        "resolved": "Date | number | string",
        "references": {
          "Date": {
            "location": "global"
          }
        }
      },
      "required": false,
      "optional": true,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "value",
      "reflect": false
    },
    "field": {
      "type": "unknown",
      "mutable": false,
      "complexType": {
        "original": "DateField",
        "resolved": "DateField",
        "references": {
          "DateField": {
            "location": "import",
            "path": "../date"
          }
        }
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      }
    }
  }; }
}
