import { DateTimeSelector } from '../e2elib/lib/src/pageobjects/datetimeselector.component'; 
 | 
import { Month } from './timeutils'; 
 | 
import { by, browser } from '../e2elib/node_modules/protractor'; 
 | 
  
 | 
export class DateTimeSelectorBase extends DateTimeSelector { 
 | 
  /** 
 | 
   * Get date from datetime selector 
 | 
   */ 
 | 
  public async getDate(): Promise<Date> { 
 | 
    const year = Number(await this.getYear()); 
 | 
    const month = Month[await this.getMonth()]; 
 | 
    const day = Number(await this.getDay()); 
 | 
    return new Date(year, month, day); 
 | 
  } 
 | 
  
 | 
  /** 
 | 
   * Get datetime from datetime selector 
 | 
   */ 
 | 
  public async getDateTime(): Promise<Date> { 
 | 
    const year = Number(await this.getYear()); 
 | 
    const month = Month[await this.getMonth()]; 
 | 
    const day = Number(await this.getDay()); 
 | 
    const hour = Number(await this.getHour()); 
 | 
    const minute = Number(await this.getMinute()); 
 | 
    const second = Number(await this.getSecond()); 
 | 
    return new Date(year, month, day, hour, minute, second); 
 | 
  } 
 | 
  
 | 
  /** 
 | 
   * Set the day, month and year value 
 | 
   * 
 | 
   * @param date date value 
 | 
   */ 
 | 
  public async setDate(date: Date): Promise<void> { 
 | 
    /* await this.setDay(date.getDate().toString()); 
 | 
    await this.setMonth((date.getMonth() + 1).toString()); 
 | 
    await this.setYear(date.getFullYear().toString());*/ 
 | 
    // Temp unblock software issue (invalid character in datetime after setting value causing test to fail) 
 | 
    await browser 
 | 
          .actions() 
 | 
          .click(this.element.element(by.css('.qDInput'))) 
 | 
          .perform() 
 | 
          .then(() => { 
 | 
            return this.element.element(by.css('.qDInput')).sendKeys(date.getDate().toString()); 
 | 
          }); 
 | 
  
 | 
    await browser.sleep(1000); 
 | 
    await browser 
 | 
    .actions() 
 | 
    .click(this.element.element(by.css('.qMInput'))) 
 | 
    .perform() 
 | 
    .then(() => { 
 | 
      return this.element.element(by.css('.qMInput')).sendKeys((date.getMonth() + 1).toString()); 
 | 
    }); 
 | 
  
 | 
    await browser.sleep(1000); 
 | 
    await browser 
 | 
    .actions() 
 | 
    .click(this.element.element(by.css('.qYInput'))) 
 | 
    .perform() 
 | 
    .then(() => { 
 | 
      return this.element.element(by.css('.qYInput')).sendKeys(date.getFullYear().toString()); 
 | 
    }); 
 | 
  } 
 | 
} 
 |