Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/effect/src/DateTime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -938,6 +938,14 @@ export const zonedOffsetIso: (self: Zoned) => string = Internal.zonedOffsetIso
*/
export const toEpochMillis: (self: DateTime) => number = Internal.toEpochMillis

/**
* Get the seconds since the Unix epoch of a `DateTime`.
*
* @since 3.16.0
* @category conversions
*/
export const toEpochSeconds: (self: DateTime) => number = Internal.toEpochSeconds

/**
* Remove the time aspect of a `DateTime`, first adjusting for the time
* zone. It will return a `DateTime.Utc` only containing the date.
Expand Down
3 changes: 3 additions & 0 deletions packages/effect/src/internal/dateTime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,9 @@ export const zonedOffsetIso = (self: DateTime.Zoned): string => offsetToString(z
/** @internal */
export const toEpochMillis = (self: DateTime.DateTime): number => self.epochMillis

/** @internal */
export const toEpochSeconds = (self: DateTime.DateTime): number => Math.floor(self.epochMillis / 1000)

/** @internal */
export const removeTime = (self: DateTime.DateTime): DateTime.Utc =>
withDate(self, (date) => {
Expand Down
Loading