momentjs - Convert string in javascript using moment -


i try convert string moment , check same.

    protected showevent(event: ievent, hour: moment): boolean {         let formatdate: moment = moment(event.futuredate);         console.log('--> formatdate', formatdate);         console.log('--> hour', hour);          return formatdate.issame(hour, "hour"); // return true same     }    

this console result

--> formatdate: moment {_isamomentobject: true, _i: "07-24-2017 07:00:00.000", _isutc: false, _pf: object, _locale: locale…}_d: mon jul 24 2017 07:00:00 gmt+0200 (cest)_i: "07-24-2017 07:00:00.000"}  --> hour: moment {_isamomentobject: true, _isutc: false, _pf: object, _locale: locale, _d: tue jul 25 2017 07:00:00 gmt+0200 (cest)…} 

how can convert date see if time same?

edit: whole looks this

protected showevent(event: ievent, hour: moment): boolean {     return moment(event.futuredate).hour() == hour.hours() } 

try comparing hour value alone.

return formatdate.hours() == hour.hours()

if looking compare entire date can compare other values e.g. minutes()


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -