ios – Database Transaction Date and Time Changing with New Timezone



I am working on a travel app that logs date and time with other data. Upon return from Frankfurt (Central European Summer Time) to the US west coast (Pacific Datelight Time) (9 hours difference) recently I noticed that all the transaction dates and times have been adjusted for the new timezone. So many transactions are showing up as taking place at two or three in the morning.

Is there a way to maintain the local date and time without converting them to the new timezone? Is the problem with the display of the data such as not correctly handling UTC?

I am using the DatePicker() to read in the date and time, then saving it to coreData without any special processing.

struct getFormData: View {

    var g: GeometryProxy

    @Binding var entryDT: Date

    var body: some View {

        // get entry date and time
        HStack (spacing: 0) {
            Image(systemName: "calendar.badge.clock")
                .frame(width: 30, height: 30)


            DatePicker("", selection: $entryDT, in: ...Date())
        .padding(.bottom, UIDevice.current.userInterfaceIdiom == .phone ? 10 : 25)
 // the save button has been pressed
    func saveButton() {

        // save entry to core data
        let newEntry = CurrTrans(context: viewContext)

        // entry id = UUID()

        // entry date
        newEntry.entryDT = entryDT

        do {

        } catch {


Below is how I display a transaction the date and time. So Lorem ipsum is saying I need to change this (in addition to changes to saving the transaction) to use the original UTC offset. How would I do that?

let hDate = item.entryDT ?? Date()