Home Project Age Calculator Posted on January 17, 2016 by Edit
Age Calculator is a Hybrid mobile app developed using Cordova. Boostrap framework for UI development. Play Store
Version

1.6.0

Dev Setup
$ npm install -g cordova
$ git clone https://github.com/codemons/age-calculator-cordova.git age-calculator
$ cd age-calculator
$ cordova platform add [android/ios/windows]
Install platform respective SDK. And then give build.
$ cordova build
This website is made possible by displaying online advertisements to our visitors.
Please consider supporting by disabling your ad blocker.
Code
var getAge = (function(){
	  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,
		  toString: function(){
			var age= [];
			if(this.years > 0) age.push(this.years+ ' year'+(this.years> 1? 's ':' '));
			if(this.months > 0) age.push(months+ ' month'+(this.months> 1? 's':''));
			if(this.days > 0) age.push(this.days+ ' day'+(this.days> 1? 's':''));
			if(age.length > 1)
			age.splice(age.length-1,0,' and ');
			return age.join('');
		  }
		};
	  }

	  return function(dob){
		return difference(new Date(), dob);
	  };
	}());
Screenshots

Free Software, Hell Yeah!
loading comments...
© 2023 Shivaji Varma. Made in India.