MCPcopy Create free account
hub / github.com/codecombat/codecombat / changeTimeZone

Function changeTimeZone

app/core/timeZoneUtils.js:3–11  ·  view source on GitHub ↗
(dateString, format, from, to, toFormat = format)

Source from the content-addressed store, hash-verified

1module.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

Calls 1

cloneMethod · 0.45

Tested by

no test coverage detected