Add TimeZone extension to produce a formated string of the form "GMT+x:00 - Timezone Identifier"

This commit is contained in:
QuentinArguillere 2024-08-13 09:51:05 +02:00
parent f21831ab2c
commit 8692d628f5
2 changed files with 20 additions and 0 deletions

View file

@ -14,6 +14,7 @@
6613A0B02BAEB7F4008923A4 /* MeetingsListFragment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6613A0AF2BAEB7F4008923A4 /* MeetingsListFragment.swift */; };
6613A0B42BAEBE3F008923A4 /* MeetingViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6613A0B32BAEBE3F008923A4 /* MeetingViewModel.swift */; };
66162A202BDFC2F900DCE913 /* AddParticipantsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66162A1F2BDFC2F900DCE913 /* AddParticipantsViewModel.swift */; };
66246C6A2C622AE900973E97 /* TimeZoneExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66246C692C622AE900973E97 /* TimeZoneExtension.swift */; };
662B69D92B25DE18007118BF /* TelecomManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 662B69D82B25DE18007118BF /* TelecomManager.swift */; };
662B69DB2B25DE25007118BF /* ProviderDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 662B69DA2B25DE25007118BF /* ProviderDelegate.swift */; };
6646A7A32BB2E224006B842A /* ScheduleMeetingFragment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6646A7A22BB2E224006B842A /* ScheduleMeetingFragment.swift */; };
@ -195,6 +196,7 @@
6613A0AF2BAEB7F4008923A4 /* MeetingsListFragment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeetingsListFragment.swift; sourceTree = "<group>"; };
6613A0B32BAEBE3F008923A4 /* MeetingViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MeetingViewModel.swift; sourceTree = "<group>"; };
66162A1F2BDFC2F900DCE913 /* AddParticipantsViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddParticipantsViewModel.swift; sourceTree = "<group>"; };
66246C692C622AE900973E97 /* TimeZoneExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimeZoneExtension.swift; sourceTree = "<group>"; };
662B69D82B25DE18007118BF /* TelecomManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TelecomManager.swift; sourceTree = "<group>"; };
662B69DA2B25DE25007118BF /* ProviderDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProviderDelegate.swift; sourceTree = "<group>"; };
6646A7A22BB2E224006B842A /* ScheduleMeetingFragment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScheduleMeetingFragment.swift; sourceTree = "<group>"; };
@ -395,6 +397,7 @@
C6DC4E3C2C199C4E009096FD /* BundleExtenion.swift */,
C628172D2C1C3A3600DBA646 /* AccountExtension.swift */,
C62817312C1C400A00DBA646 /* StringExtension.swift */,
66246C692C622AE900973E97 /* TimeZoneExtension.swift */,
);
path = Extensions;
sourceTree = "<group>";
@ -1127,6 +1130,7 @@
D72343322ACEFF58009AA24E /* QRScannerController.swift in Sources */,
662B69D92B25DE18007118BF /* TelecomManager.swift in Sources */,
D72343342ACEFFC3009AA24E /* QRScanner.swift in Sources */,
66246C6A2C622AE900973E97 /* TimeZoneExtension.swift in Sources */,
66C491FB2B24D32600CEA16D /* CoreExtension.swift in Sources */,
D7F5F6412C359F3B007FCF2F /* SipAddressesPopup.swift in Sources */,
D72A9A052B9750A1000DC093 /* UIList.swift in Sources */,

View file

@ -0,0 +1,16 @@
//
// TimeZoneExtension.swift
// Linphone
//
// Created by QuentinArguillere on 06/08/2024.
//
import Foundation
extension TimeZone {
// Format timezone identifier as a string of the form : GMT{+,-}[-12, 12]:00 - {Identifier}
func formattedString() -> String {
let gmtOffset = self.secondsFromGMT()/3600
return "GMT\(gmtOffset >= 0 ? "+" : "")\(gmtOffset):00 - \(self.identifier)"
}
}