Module:Age: Difference between revisions

    (update from sandbox: Template:Death date and age now gives an error if the death date is in future by more than one day)
    Line 9: Line 9:
    ['mt-conflicting-show'] =      'Parameter show=$1 conflicts with round=$2',
    ['mt-conflicting-show'] =      'Parameter show=$1 conflicts with round=$2',
    ['mt-date-wrong-order'] =      'The second date must be later in time than the first date',
    ['mt-date-wrong-order'] =      'The second date must be later in time than the first date',
    ['mt-dd-future'] =              'Death date (first date) must not be in the future',
    ['mt-dd-wrong-order'] =        'Death date (first date) must be later in time than the birth date (second date)',
    ['mt-dd-wrong-order'] =        'Death date (first date) must be later in time than the birth date (second date)',
    ['mt-invalid-bd-age'] =        'Invalid birth date for calculating age',
    ['mt-invalid-bd-age'] =        'Invalid birth date for calculating age',
    Line 923: Line 924:
    if diff.isnegative then
    if diff.isnegative then
    return message('mt-dd-wrong-order')
    return message('mt-dd-wrong-order')
    end
    local Date = getExports(frame)
    local today = Date('currentdate') + 1  -- one day in future allows for timezones
    if date1 > today then
    return message('mt-dd-future')
    end
    end
    local years
    local years