MCPcopy Create free account
hub / github.com/scottrogowski/code2flow / cloneWithOffset

Function cloneWithOffset

tests/test_code/js/moment/moment.js:3260–3275  ·  view source on GitHub ↗
(input, model)

Source from the content-addressed store, hash-verified

3258
3259 // Return a moment from input, that is local/utc/zone equivalent to model.
3260 function cloneWithOffset(input, model) {
3261 var res, diff;
3262 if (model._isUTC) {
3263 res = model.clone();
3264 diff =
3265 (isMoment(input) || isDate(input)
3266 ? input.valueOf()
3267 : createLocal(input).valueOf()) - res.valueOf();
3268 // Use low-level api, because this fn is low-level api.
3269 res._d.setTime(res._d.valueOf() + diff);
3270 hooks.updateOffset(res, false);
3271 return res;
3272 } else {
3273 return createLocal(input).local();
3274 }
3275 }
3276
3277 function getDateOffset(m) {
3278 // On Firefox.24 Date#getTimezoneOffset returns a floating point.

Callers 3

momentsDifferenceFunction · 0.85
calendar$1Function · 0.85
diffFunction · 0.85

Calls 3

isMomentFunction · 0.85
isDateFunction · 0.85
createLocalFunction · 0.85

Tested by

no test coverage detected