Function
changeTimeZone
(dateString, format, from, to, toFormat = format)
Source from the content-addressed store, hash-verified
| 1 | module.exports = (moment) => { |
| 2 | return { |
| 3 | changeTimeZone (dateString, format, from, to, toFormat = format) { |
| 4 | moment.locale('en') |
| 5 | const date = moment.tz(dateString, format, from) |
| 6 | const dateInNewTimezone = date.clone().tz(to) |
| 7 | if (toFormat) { |
| 8 | return dateInNewTimezone.format(toFormat) |
| 9 | } |
| 10 | return dateInNewTimezone |
| 11 | } |
| 12 | } |
| 13 | } |
Callers
nothing calls this directly
Tested by
no test coverage detected