<commit_before>import {OnInit, Input, Output, EventEmitter, Component} from '@angular/core';
import {Validators, REACTIVE_FORM_DIRECTIVES, FormBuilder, FormGroup, FormControl, FORM_DIRECTIVES } from '@angular/forms';
import {Utils} from '../../../../commons/ram-utils';
import {RAMNgValidators} from '../../commons/ram-ng-validators';
import {Calendar} from 'primeng/primeng';

@Component({
    selector: 'access-period',
    templateUrl: 'access-period.component.html',
    directives: [REACTIVE_FORM_DIRECTIVES,FORM_DIRECTIVES,Calendar]
})
export class AccessPeriodComponent implements OnInit {

    public form: FormGroup;

    @Input('data') public data: AccessPeriodComponentData;

    @Output('dataChange') public dataChanges = new EventEmitter<AccessPeriodComponentData>();

    @Output('isValid') public isValid = new EventEmitter<boolean>();

    constructor(private _fb: FormBuilder) {
    }

    public ngOnInit() {
        const startDate = this.data.startDate;
        const endDate = this.data.endDate;
        const formattedStartDate:string = startDate === null ? null : startDate.toISOString().slice(0, 10);
        const formattedEndDate:string = endDate === null ? null : endDate.toISOString().slice(0, 10);
        this.form = this._fb.group({
            'startDate': [formattedStartDate,<commit_msg>RAM-308 null and undefined check in the access period component<commit_after>import {OnInit, Input, Output, EventEmitter, Component} from '@angular/core';
import {Validators, REACTIVE_FORM_DIRECTIVES, FormBuilder, FormGroup, FormControl, FORM_DIRECTIVES } from '@angular/forms';
import {Utils} from '../../../../commons/ram-utils';
import {RAMNgValidators} from '../../commons/ram-ng-validators';
import {Calendar} from 'primeng/primeng';

@Component({
    selector: 'access-period',
    templateUrl: 'access-period.component.html',
    directives: [REACTIVE_FORM_DIRECTIVES,FORM_DIRECTIVES,Calendar]
})
export class AccessPeriodComponent implements OnInit {

    public form: FormGroup;

    @Input('data') public data: AccessPeriodComponentData;

    @Output('dataChange') public dataChanges = new EventEmitter<AccessPeriodComponentData>();

    @Output('isValid') public isValid = new EventEmitter<boolean>();

    constructor(private _fb: FormBuilder) {
    }

    public ngOnInit() {
        const startDate = this.data.startDate;
        const endDate = this.data.endDate;
        const formattedStartDate:string = startDate === null || startDate === undefined ? null : startDate.toISOString().slice(0, 10);
        const formattedEndDate:string = endDate === null || endDate === undefined ? null : endDate.toISOString().slice(0, 10);
        this.form = this._fb.group({
            'startDate': [formattedStartDate,
{'fraction_non_alphanumeric': 0.13228862973760933, 'fraction_numerical': 0.005466472303206997, 'mean_word_length': 4.392927308447937, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2144955', 'n_tokens_mistral': 785, 'n_tokens_neox': 773, 'n_words': 186}