Я использую моменты-timezone.js
, но я получаю это исключение:
moment-timezone.js:476 Moment Timezone has no data for Asia/Jerusalem
Я пошел к tz ссылки
и я вижу Asia/Jerusalem
существует.
Так в чем может быть проблема?
toolFilters.filter('dateAccordingToTimeZone', function ($filter) {
// Gets the number of milliseconds pass from 1970 and convert it to time according to given timezone, currently
// supported “Asia/Jerusalem” and “America/Los_Angeles”
return function (milliSeconds, timeZoneId) {
if (milliSeconds == 0) {
return "";
}
var timeInt = parseInt(milliSeconds, 10);
var response = "";
if (timeZoneId === undefined) {
response = moment(timeInt);
} else if (timeZoneId.includes("/")) { //like "America/New_York"
response = moment.tz(timeInt, timeZoneId);
} else if (timeZoneId.includes("GMT")) {
var offset = timeZoneId.substring(3); //like "GMT-08:00"
response = moment(timeInt).utcOffset(offset);
} else {
response = moment(timeInt);
}
var response = response.format('MMM D, YYYY H:mm:ss');
console.log(response);
return response;
}
У меня есть эти импорты:
<script src="bower_components/moment/moment.js"></script>
<script src="bower_components/moment-timezone/moment-timezone.js"></script>