File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,8 @@ public extension MetadataTerritory {
4949 let possibleNationalPrefixForParsing : String ? = try container. decodeIfPresent ( String . self, forKey: . nationalPrefixForParsing)
5050 let possibleNationalPrefix : String ? = try container. decodeIfPresent ( String . self, forKey: . nationalPrefix)
5151 nationalPrefix = possibleNationalPrefix
52- nationalPrefixForParsing = ( possibleNationalPrefixForParsing == nil && possibleNationalPrefix != nil ) ? nationalPrefix : possibleNationalPrefixForParsing
52+ let nationalPrefixForParsing = ( possibleNationalPrefixForParsing == nil && possibleNationalPrefix != nil ) ? nationalPrefix : possibleNationalPrefixForParsing
53+ self . nationalPrefixForParsing = nationalPrefixForParsing != nil ? nationalPrefixForParsing!. replacingOccurrences ( of: " \\ " , with: #"\\"# ) : nil
5354 nationalPrefixFormattingRule = try container. decodeIfPresent ( String . self, forKey: . nationalPrefixFormattingRule)
5455 let availableFormats = try ? container. nestedContainer ( keyedBy: CodingKeys . self, forKey: . availableFormats)
5556 let temporaryFormatList : [ MetadataPhoneNumberFormat ] = availableFormats? . decodeArrayOrObject ( forKey: . numberFormats) ?? [ MetadataPhoneNumberFormat] ( )
Original file line number Diff line number Diff line change @@ -692,5 +692,11 @@ final class PartialFormatterTests: XCTestCase {
692692 _ = partialFormatter. formatPartial ( " +7 " )
693693 XCTAssertEqual ( partialFormatter. currentRegion, " RU " )
694694 }
695+
696+ func testJerseyPhoneNumberWithoutPrefix( ) {
697+ let partialFormatter = PartialFormatter ( utility: utility, defaultRegion: " JE " , withPrefix: false )
698+ let testNumber = " 078297 "
699+ XCTAssertEqual ( partialFormatter. formatPartial ( testNumber) , " 7829 7 " )
700+ }
695701}
696702#endif
You can’t perform that action at this time.
0 commit comments