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

const dvnFieldDisplayCellDateCss = ".sc-dvn-field-display-cell-date-h{display:block;padding:6px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}";

let DvnFieldDisplayCellDate = 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 = momentTimezone(date).tz(this.meta.timeZone).format(this.field.dateFormat);
      }
      else {
        formattedDate = momentTimezone(date).format(this.field.dateFormat);
      }
    }
    return (h(Host, null, formattedDate));
  }
};
DvnFieldDisplayCellDate.style = dvnFieldDisplayCellDateCss;

export { DvnFieldDisplayCellDate as dvn_field_display_cell_date };
