DateManager.swift 633 Bytes
//
//  DateManager.swift
//  browser
//
//  Created by Artem Talko on 17.10.2023.
//

import Foundation


final class DateManager {
    static let shared = DateManager()
    
    private init() {}
    
    func getTimeFromDB(_ date: Date?) -> String {
        let timeFormatter = DateFormatter()
        timeFormatter.dateFormat = "h:mm a"
        return timeFormatter.string(from: date ?? Date())
    }
    
    var dateFormatter: DateFormatter{
        let obj = DateFormatter()
        obj.dateFormat = "EEEE, d MMM"
        return obj
    }
    
    var currentDate: Date {
        let obj = Date()
        return obj
    }
}