import { r as registerInstance, h, H as Host } from './index-b7735e0d.js';
import { h as hooks } from './moment-6f6ab70c.js';
import { a as DateDataType } from './date-ce777316.js';
import './BaseField-461b6d0c.js';

const dvnFieldDisplayDateCss = ".sc-dvn-field-display-date-h{display:block;height:20px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}";

let DvnFieldDisplayDate = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
  }
  render() {
    let date = this.value;
    if (this.field.dateDataType === DateDataType.ISO) {
      date = new Date(this.value);
    }
    else if (this.field.dateDataType === DateDataType.Unix) {
      date = new Date(this.value * 1000);
    }
    let formattedDate = '';
    if (this.value) {
      if (this.meta.timeZone) {
        formattedDate = hooks(date).tz(this.meta.timeZone).format(this.field.dateFormat);
      }
      else {
        formattedDate = hooks(date).format(this.field.dateFormat);
      }
    }
    return (h(Host, null, formattedDate));
  }
};
DvnFieldDisplayDate.style = dvnFieldDisplayDateCss;

export { DvnFieldDisplayDate as dvn_field_display_date };
