Last active
January 17, 2018 16:44
-
-
Save lukecampbell/11aba05d57d4cf6a5051a949a5495792 to your computer and use it in GitHub Desktop.
Equality Properties of moment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); |
Author
lukecampbell
commented
Jan 17, 2018
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment