Skip to content

Instantly share code, notes, and snippets.

@lukecampbell
Last active January 17, 2018 16:44
Show Gist options
  • Save lukecampbell/11aba05d57d4cf6a5051a949a5495792 to your computer and use it in GitHub Desktop.
Save lukecampbell/11aba05d57d4cf6a5051a949a5495792 to your computer and use it in GitHub Desktop.
Equality Properties of moment
const moment = require('moment');
let a = moment.utc('2018-01-16T13:00:00Z');
let b = moment('2018-01-16T13:00:00Z');
let c = moment.utc('2018-01-16T13:00:00Z');
// Reflexive
console.log('reflexive');
console.log('a == a', a.isSame(a));
// Symmetric
console.log('symmetric');
console.log('a == b', a.isSame(b));
console.log('b == a', b.isSame(a));
// Transitive
console.log('transitive');
console.log('a == b', a.isSame(b));
console.log('b == c', b.isSame(c));
console.log('a == c', a.isSame(c));
@lukecampbell
Copy link
Author

lukecampbell commented Jan 17, 2018

reflexive
a == a true
symmetric
a == b true
b == a true
transitive
a == b true
b == c true
a == c true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment