Skip to content

Converters from LocalDate and LocalDateTime to NSDateΒ #322

Open
@dkhalanskyjb

Description

@dkhalanskyjb

We received a few requests to add converters from LocalDate and LocalDateTime to NSDate. Given that NSDate is essentially the same as Instant, they could look something like this:

fun LocalDate.toNSDateAtStartOfDayIn(timeZone: TimeZone) =
  atStartOfDayIn(timeZone).toNSDate()

fun LocalDateTime.toNSDate(timeZone: TimeZone) =
  toInstant(timeZone).toNSDate()

They seem quite short, but if they are tricky to get right, maybe we could introduce them to the library.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions