В моем случае использования я получаю значение индекса часового пояса Microsoft. Индекс вы найдете здесь. Мне нужен этот индекс, чтобы получить часовой пояс элемента.
Чтобы установить собственный часовой пояс в Swift, я только что нашел этот фрагмент.
dateformatter.timeZone = NSTimeZone(abbreviation: "CEST")
И здесь я нашел список со всеми сокращениями
ADT = "America/Halifax";
AKDT = "America/Juneau";
AKST = "America/Juneau";
ART = "America/Argentina/Buenos_Aires";
AST = "America/Halifax";
BDT = "Asia/Dhaka";
[...]
WET = "Europe/Lisbon";
WIT = "Asia/Jakarta";
Так что у меня есть вся информация. Время в формате UTC/GMT. Значение индекса и все возможные часовые пояса в Swift. Но я не могу понять, какой часовой пояс для чего.
Например, в значениях индекса часовых поясов Microsoft указано 001 «Стандартное время Самоа — GMT-11:00 Остров Мидуэй, Самоа».
Но что это в быстром? Я не могу сделать что-то вроде
dateformatter.timeZone = NSTimeZone(abbreviation: "GMT-11") //not found the abbreviation
У кого-нибудь есть идеи или предложения по решению проблемы?