obiba / magma

Data and meta-data abstraction layer.
http://www.obiba.org
GNU General Public License v3.0
6 stars 14 forks source link

MAGMA-172: Add method to obtain the duration between two dates or two datetime (maybe add support to minus method) #314

Open ymarcon opened 12 years ago

ymarcon commented 12 years ago

Jira issue originally created by user @plaflamme:

Overload the minus method: $('DATE').minus($('ANOTHER_DATE')) or create a new specific method: $('DATE').duration($('ANOTHER_DATE'))

ymarcon commented 12 years ago

Comment created by @plaflamme:

The result should have the proper unit (seconds for example) this way, one could convert them to other units:

// Compute the duration (in seconds) and convert to hours
$('DATE').duration($('ANOTHER_DATE')).toUnit('h')