import { r as registerInstance, h, H as Host } from './index-ecdfb761.js';
import { m as momentTimezone } from './index-a3ca021c.js';
import { a as DateDataType } from './date-1bc489bd.js';
import './_commonjsHelpers-27f122dd.js';
import './moment-65eca6b3.js';
import './BaseField-0b01dc2c.js';

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

const 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 };
