I am getting date from JSON and i need to add some days to that date
"flash_packages": [
{
"id": 78,
"duration": 20,
"purchase_date": "2022-05-26",
here i need to add duration to purchase_date here duration is number of days
code: here i have turned json date string to date using dateOnly()..here how to add 20 days to this date 26.05.2022
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "FlashTableViewCell", for: indexPath) as! FlashTableViewCell
let indexData = viewBooster?.result?.flash_packages?[indexPath.row]
let purchasedDate = indexData?.purchase_date?.dateOnly() ?? ""
let duration = indexData?.duration ?? 0
print("Purchased date: \(purchasedDate), and the duration is \(duration) days")
return cell
}
here how to add 20 days to this date 26.05.2022, please guide me.
0/p:
Purchased date: 26.05.2022, and the duration is: 20 days