import { DOCUMENT } from '@angular/common';
import { Directive, HostListener, Inject } from '@angular/core';

@Directive({
    selector: '[appGjDatetime]',
    standalone: true
})
export class GjDatetimeDirective {
  ionDatetime: any;
  canOverride = true;

  constructor(@Inject(DOCUMENT) private document: Document) { }


  @HostListener('click', ['$event.target'])
  onClick(el: { shadowRoot: { appendChild: (arg0: HTMLStyleElement) => void } }) {
    if (this.canOverride) {
      const style = this.document.createElement('style');
      style.innerHTML = ':host(.month-year-picker-open) .datetime-footer { display: block !important; }';
      el.shadowRoot.appendChild(style);
      this.canOverride = false;
    }
  }

}
