Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversion between Time and Swift.Date #84

Open
coenttb opened this issue Sep 5, 2024 · 0 comments
Open

Conversion between Time and Swift.Date #84

coenttb opened this issue Sep 5, 2024 · 0 comments

Comments

@coenttb
Copy link

coenttb commented Sep 5, 2024

I've been exploring the time package and have found it to be a robust solution for handling dates and times. However, I've noticed that there doesn't seem to be a direct way to convert between the package's types and Swift's standard Date type.

Given that interoperability with existing codebases and libraries often requires working with Date, I was wondering about the rationale behind this design decision.

Some example syntax:

import Foundation
import Testing
import Date

@Test
func test(){    
    let systemClock = Clocks.system

    let threeMonthsFromNow = systemClock.currentDay + .months(3)
    
    let date: Date = .init(threeMonthsFromNow)
    
    print(date)
}

I understand that the package's types offer more precision and correctness, especially when dealing with different calendars and time zones. However, I'm curious about how to best bridge the gap when working in a mixed environment.
Thank you for your time and for creating this valuable package. I look forward to understanding more about this aspect of the library's design.

@coenttb coenttb changed the title Conversion between Instant and Swift.Date Conversion between Time and Swift.Date Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant