Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---
- birthday: 1975-05-26
- ---
- ```dataviewjs
- const today = dv.func.date('today');
- const birthday = dv.current().birthday;
- function difference(d1, d2) {
- var m = moment(d1);
- var years = m.diff(d2, 'years');
- m.add(-years, 'years');
- var months = m.diff(d2, 'months');
- m.add(-months, 'months');
- var days = m.diff(d2, 'days');
- return {years: years, months: months, days: days};
- }
- y = difference(Date.parse(today), Date.parse(birthday));
- dv.span(y)
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement