moment-timezone icon indicating copy to clipboard operation
moment-timezone copied to clipboard

get zoneName not match

Open do-ift opened this issue 3 years ago • 0 comments

Describe the bug result of function moment().zoneName() not match.

To Reproduce I have time with

_z:{
  abbrs: ["LMT", "PLMT", "+07", "+08", "+09", "+07", "+08", "+07", "+08", "+07"] (10)
  name: "Asia/Ho_Chi_Minh"
  offsets: [-426.6666666666667, -426.5, -420, -480, -540, -420, -480, -420, -480, -420] (10)
  population: 9000000
  untils: [-2004073600000, -1851577590000, -852105600000, -782643600000, -767869200000,
}

console.log(moment(time).zoneName()); // +07 console.log(moment(time).zoneAbbr()); // +07

Expected behavior I think when I using console.log(moment(time).zoneName()), the result has been Asia/Ho_Chi_Minh

Additional context I found on moment-timezone.js file fn.zoneName = abbrWrap(fn.zoneName);

but

function abbrWrap (old) {
	return function () {
		if (this._z) { return this._z.abbr(this); }
			return old.call(this);
		};
	}

it return to abbr name.

moment-timezone version: 0.5.33

do-ift avatar Mar 12 '21 05:03 do-ift