<commit_before>const moment           = require('moment');
const DatePicker       = require('../../components/date_picker');
const dateValueChanged = require('../../../_common/common_functions').dateValueChanged;
const toISOFormat      = require('../../../_common/string_util').toISOFormat;

const generateBirthDate = (min_age) => {
    const date_of_birth = '#date_of_birth';

    if (!$(date_of_birth).val()) {
        DatePicker.init({
            selector : date_of_birth,
            minDate  : -100 * 365,
            maxDate  : (-min_age * 365) - 5,
            yearRange: '-100:-18',
        });
        $(date_of_birth)
            .attr('data-value', toISOFormat(moment()))
            .change(function () {
                return dateValueChanged(this, 'date');
            })
            .val('');
    }
};

module.exports = generateBirthDate;<commit_msg>subtract leap years number dynamic<commit_after>const moment           = require('moment');
const DatePicker       = require('../../components/date_picker');
const dateValueChanged = require('../../../_common/common_functions').dateValueChanged;
const toISOFormat      = require('../../../_common/string_util').toISOFormat;

const generateBirthDate = (min_age) => {
    const date_of_birth = '#date_of_birth';

    if (!$(date_of_birth).val()) {
        DatePicker.init({
            selector : date_of_birth,
            minDate  : -100 * 365,
            maxDate  : (-min_age * 365) - Math.trunc(min_age/4) - 1,
            yearRange: '-100:-18',
        });
        $(date_of_birth)
            .attr('data-value', toISOFormat(moment()))
            .change(function () {
                return dateValueChanged(this, 'date');
            })
            .val('');
    }
};

module.exports = generateBirthDate;
{'fraction_non_alphanumeric': 0.16245081506464307, 'fraction_numerical': 0.017425519955030916, 'mean_word_length': 2.1448763250883394, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '11810', 'n_tokens_mistral': 546, 'n_tokens_neox': 505, 'n_words': 88}