<commit_before>const Errors                    = use('core/errors');

const DefaultProperty           = require('./default');


class DateProperty extends DefaultProperty {

    constructor() {
        super();

        this._addValidator((value, propertyName) => {
            const originalValue = value;

            if(typeof value == 'string'){
                value = new Date(value);
            }

            if (value && (!(value instanceof Date) ||  isNaN(value.getTime()))) {
                throw new Errors.Validation(`property ${propertyName} should be a valid DateTime, given '${originalValue}'`);
            }
        });

        this._inputModification = (value) => {
            if (!value) {
                return value;
            }
            return (typeof value === "object" && value instanceof Date) ? value : new Date(value + (value.length > 10 ? '' : ' Z') );
        };
    }

}<commit_msg>Pull request comments fix.<commit_after>const Errors                    = use('core/errors');

const DefaultProperty           = require('./default');


class DateProperty extends DefaultProperty {

    constructor() {
        super();

        this._addValidator((value, propertyName) => {
            const originalValue = value;

            if(typeof value == 'string'){
                value = new Date(value);
            }

            if (value && (!(value instanceof Date) ||  isNaN(value.getTime()))) {
                throw new Errors.Validation(`property ${propertyName} should be a valid DateTime, given '${originalValue}'`);
            }
        });

        this._inputModification = (value) => {
            return (typeof value === "object" && (value instanceof Date || value === null)) ? value : new Date(value + (value.length > 10 ? '' : ' Z') );
        };
    }

}
{'fraction_non_alphanumeric': 0.13930348258706468, 'fraction_numerical': 0.002211166390270868, 'mean_word_length': 1.896, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '3072419', 'n_tokens_mistral': 462, 'n_tokens_neox': 438, 'n_words': 119}