// note with the "(India Standard Time)" at the end of the string it won't
pass a strict moment parse check
moment('Thu Feb 25 2015 02:57:08 GMT+0530 (India Standard Time)', 'ddd MMM
D YYYY HH:mm:ss Z', true).isValid(); // false
// if you relax it, it works
var a = moment('Thu Feb 25 2015 02:57:08 GMT+0530 (India Standard Time)',
'ddd MMM D YYYY HH:mm:ss Z');
a.isValid(); // true
var b = moment('Thu Feb 26 2015 03:34:29 GMT+0530 (India Standard Time)',
'ddd MMM D YYYY HH:mm:ss Z');
b.isValid(); // true
Math.abs(a.diff(b, 'minutes')) >= 30; // true-- Daniel R. <[email protected]> [http://danielr.neophi.com/] On Wed, Feb 25, 2015 at 5:14 PM, Satish B <[email protected]> wrote: > I'm using node.js and npm moment.js > > I've 2 dates in the following format: > Thu Feb 25 2015 02:57:08 GMT+0530 (India Standard Time) > Thu Feb 26 2015 03:34:29 GMT+0530 (India Standard Time) > > I need to check if there is at least 30 min difference between the 2 > timigns. > > Moment.js http://momentjs.com/ > > *Thanks ..* > > -- > Job board: http://jobs.nodejs.org/ > New group rules: > https://gist.github.com/othiym23/9886289#file-moderation-policy-md > Old group rules: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > --- > You received this message because you are subscribed to the Google Groups > "nodejs" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/nodejs/fea454b2-2e60-41a1-9a0e-cf8c79d2a73d%40googlegroups.com > <https://groups.google.com/d/msgid/nodejs/fea454b2-2e60-41a1-9a0e-cf8c79d2a73d%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Job board: http://jobs.nodejs.org/ New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/CAETDeSCkmP4kTVUVD0PAP6BJpmKEpJdc6EOV1O%3DbkThhkcCNGw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
