import { Component } from '@angular/core' ; import { RenderFieldComponent } from '../../fields/components.fields' ; @ Component ( { selector : 'cmdb-input-appends' , templateUrl : './input-appends.component.html' , styleUrls : [ './input-appends.component.scss' ] } ) export class InputAppendsComponent extends RenderFieldComponent { constructor ( ) { super ( ) ; } public changeValueToDefault ( ) { if ( this . data . default && this . data . type === 'date' && ! this . data . default . hasOwnProperty ( '$date' ) ) { const d = new Date ( this . data . default ) ; d . setMinutes ( d . getMinutes ( ) - d . getTimezoneOffset ( ) ) ; this . controller . setValue ( { $date : d . getTime ( ) } ) ; } else { this . controller . setValue ( this . data . default ? this . data . default : null ) ; } this . controller . markAsDirty ( { onlySelf : true } ) ; this . controller . markAsTouched ( { onlySelf : true } ) ; this . parentFormGroup . markAsTouched ( { onlySelf : true } ) ; this . parentFormGroup . markAsDirty ( { onlySelf : true } ) ; } }