Created
May 23, 2017 11:43
-
-
Save srttk/947d95338847bc833f94a8becc2c482e to your computer and use it in GitHub Desktop.
get set typescript properties
This file contains 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
// Format conversions | |
get _startDate() { | |
if (this.startDate) { | |
let d = new Date(this.startDate); | |
return d.toLocaleDateString(); | |
} | |
return ''; | |
} | |
set _startDate(value) { | |
if (value) { | |
let d = new Date(value); | |
let utcDate = new Date(Date.UTC(d.getFullYear(), d.getMonth(), d.getDate(), 0, 0, 0)) | |
this.startDate = utcDate.toJSON(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment