import { r as registerInstance, h, H as Host } from './index-acdc1ac0.js';
import './BaseField-d94c5b14.js';
import { a as DateDataType } from './date-b270be76.js';
import { h as hooks } from './moment-6f6ab70c.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);
    }
    return (h(Host, null, this.value ? hooks(date).format(this.field.dateFormat) : ''));
  }
};
DvnFieldDisplayCellDate.style = dvnFieldDisplayCellDateCss;

export { DvnFieldDisplayCellDate as dvn_field_display_cell_date };
