0

I am using Low Nice Date (Good and simple addon BTW) to calculate elapsed time between current date and an even in years past. The problem seems to be that it is not taking into account the leap years.

Does anyone know if this can be corrected? @Low ?

**EDIT

{exp:low_nice_date:range from="{my_date}" to="{current_time}" localize="yes"}{years} YEARS - {months} MONTHS - {days} DAYS{/exp:low_nice_date:range}

Where {my_date} is an epoch date set in a global variable as '875966400'

1 Answer 1

0

The way Low Nice Date calculates the range is just by some intervals between the two timestamps:

$data['years']  = floor($diff / (365*60*60*24));
$data['months'] = floor(($diff - $data['years'] * 365*60*60*24) / (30*60*60*24));
$data['days']   = floor(($diff - $data['years'] * 365*60*60*24 - $data['months']*30*60*60*24) / (60*60*24));

So yeah, it doesn't take leap years into account. I'm afraid that's the way it is.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.