cla-bot · GitHub

This PR adds support for time zone environment values to date pickers in Skip UI.

import SwiftUI
import Foundation
struct DatePickerTimeZoneDemo: View {
    @State private var date = Date()
    private let customTimeZone = TimeZone(identifier: "America/Los_Angeles")!
    var body: some View {
        Form {
            Section("System Time Zone") {
                DatePicker(
                    "Time",
                    selection: self.$date,
                    displayedComponents: .hourAndMinute
                )
            }
            Section("Custom Time Zone (America/Los_Angeles)") {
                DatePicker(
                    "Time",
                    selection: self.$date,
                    displayedComponents: .hourAndMinute
                )
                .environment(\.timeZone, self.customTimeZone)
            }
        }
    }
}

Thank you for contributing to the Skip project! Please review the contribution guide at https://skip.dev/docs/contributing/ for advice and guidance on making high-quality PRs.

Use this space to describe your change and add any labels (bug, enhancement, documentation, etc.) to help categorize your contribution.

Read the original on github.com ↗