I need to calculate the difference between two dates to try find the end of services of the employee
favorite Possible Duplicate: How do I get the difference between two Dates in ionic3?
How to get the difference between two dates using ionic3.I need the exact day difference between those two dates.Here is my code
This is a Ts file
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-js -->
import { Component } from '@angular/core';
import { NavController, DateTime,NavParams } from 'ionic-angular';
import { IfStmt } from '@angular/compiler';
import { DatePipe, DOCUMENT, getLocaleMonthNames } from '@angular/common';
import { daysInMonth, parseDate } from 'ionic-angular/util/datetime-util';
import { toBase64String } from '@angular/compiler/src/output/source_map';
import { Console } from '@angular/core/src/console';
@Component({
selector: 'page-about',
templateUrl: 'about.html'
})
export class AboutPage {
datef;
datett;
dated1
dated2;
timeDiff;
typeOfDateYear;
typeOfDateMonth;
constructor(public navCtrl: NavController) {
}
performFunction(type){
var d1 = parseFloat(this.dated1);
var d2 = parseFloat(this.dated2);
var f = parseInt (this.datef);
var tt = parseInt (this.datett);
console.log(type);
if(type =='a'){
this.typeOfDateYear = tt - f
this.typeOfDateMonth = this.typeOfDateYear / (24* 3600* 1000)
}
}
}
Any suggestion?