0

am getting date and time from api .. and am converting it like this:

   let inputDateAsString = match.dateGregorian!
   let formatter = DateFormatter()
   formatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
   if let date = formatter.date(from: inputDateAsString) {
     if MOLHLanguage.isArabic(){
        formatter.locale = NSLocale(localeIdentifier: "eng") as Locale?
     }else{
        formatter.locale = NSLocale(localeIdentifier: "eng") as Locale?
      }
     formatter.dateFormat = "hh:mm a"
     let outputDate = formatter.string(from: date)
     time = outputDate
     time = time.replacingOccurrences(of: "PM", with: "م")

      }else {
  print("There was an error decoding the string")
 }

this works perfectly fine in most devices ... just in one device it will not work and it will not enter this and returns null .. why?

it will always return this There was an error decoding the string in this one device...

and how to solve this?

lamatat
  • 503
  • 1
  • 10
  • 21

0 Answers0