Created
March 10, 2020 01:29
-
-
Save TonyDotDev/b96e9815d2c3a3f63196c260fc3096a5 to your computer and use it in GitHub Desktop.
Working With DateTime MomentJS
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
import moment from "moment"; | |
export const convertDateTimeToCurrentTimezone = dateTime => { | |
const utcOffset = moment().utcOffset(); | |
return moment(dateTime).add(utcOffset, "minutes"); | |
}; | |
const createUTCDateTime = date => | |
moment(date) | |
.utc() | |
.format("YYYY-MM-DD HH:mm:ss"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment