(
part: DateTime.UnitSingular,
options?: {
readonly weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | undefined
}
): <A extends DateTime>(self: A) => A
<A extends DateTime>(
self: A,
part: DateTime.UnitSingular,
options?: {
readonly weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | undefined
}
): AConverts a DateTime to the start of the given part.
Details
If the part is week, the weekStartsOn option can be used to specify the
day of the week that the week starts on. The default is 0 (Sunday).
Example (Rounding down DateTime values)
import { DateTime } from "effect"
// returns "2024-01-01T00:00:00Z"
DateTime.makeUnsafe("2024-01-01T12:00:00Z").pipe(
DateTime.startOf("day"),
DateTime.formatIso
)export const const startOf: {
(
part: DateTime.UnitSingular,
options?: {
readonly weekStartsOn?:
| 0
| 1
| 2
| 3
| 4
| 5
| 6
| undefined
}
): <A extends DateTime>(self: A) => A
<A extends DateTime>(
self: A,
part: DateTime.UnitSingular,
options?: {
readonly weekStartsOn?:
| 0
| 1
| 2
| 3
| 4
| 5
| 6
| undefined
}
): A
}
Converts a DateTime to the start of the given part.
Details
If the part is week, the weekStartsOn option can be used to specify the
day of the week that the week starts on. The default is 0 (Sunday).
Example (Rounding down DateTime values)
import { DateTime } from "effect"
// returns "2024-01-01T00:00:00Z"
DateTime.makeUnsafe("2024-01-01T12:00:00Z").pipe(
DateTime.startOf("day"),
DateTime.formatIso
)
startOf: {
(
part: DateTime.UnitSingularpart: DateTime.type DateTime.UnitSingular = "millisecond" | "second" | "minute" | "hour" | "day" | "week" | "month" | "year"Singular date and time unit names used by rounding APIs such as
DateTime.startOf, DateTime.endOf, and DateTime.nearest.
UnitSingular,
options: | {
readonly weekStartsOn?:
| 0
| 1
| 2
| 3
| 4
| 5
| 6
| undefined
}
| undefined
options?: { readonly weekStartsOn?: 0 | 2 | 1 | 3 | 4 | 5 | 6 | undefinedweekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | undefined }
): <function (type parameter) A in <A extends DateTime>(self: A): AA extends type DateTime = Utc | ZonedA DateTime represents a point in time. It can optionally have a time zone
associated with it.
Companion namespace containing the public helper types used by DateTime
constructors, parts APIs, formatting, and date/time arithmetic.
DateTime>(self: A extends DateTimeself: function (type parameter) A in <A extends DateTime>(self: A): AA) => function (type parameter) A in <A extends DateTime>(self: A): AA
<function (type parameter) A in <A extends DateTime>(self: A, part: DateTime.UnitSingular, options?: {
readonly weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | undefined;
}): A
A extends type DateTime = Utc | ZonedA DateTime represents a point in time. It can optionally have a time zone
associated with it.
Companion namespace containing the public helper types used by DateTime
constructors, parts APIs, formatting, and date/time arithmetic.
DateTime>(
self: A extends DateTimeself: function (type parameter) A in <A extends DateTime>(self: A, part: DateTime.UnitSingular, options?: {
readonly weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | undefined;
}): A
A,
part: DateTime.UnitSingularpart: DateTime.type DateTime.UnitSingular = "millisecond" | "second" | "minute" | "hour" | "day" | "week" | "month" | "year"Singular date and time unit names used by rounding APIs such as
DateTime.startOf, DateTime.endOf, and DateTime.nearest.
UnitSingular,
options: | {
readonly weekStartsOn?:
| 0
| 1
| 2
| 3
| 4
| 5
| 6
| undefined
}
| undefined
options?: { readonly weekStartsOn?: 0 | 2 | 1 | 3 | 4 | 5 | 6 | undefinedweekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | undefined }
): function (type parameter) A in <A extends DateTime>(self: A, part: DateTime.UnitSingular, options?: {
readonly weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | undefined;
}): A
A
} = import InternalInternal.const startOf: {
(
part: DateTime.DateTime.UnitSingular,
options?: {
readonly weekStartsOn?:
| 0
| 1
| 2
| 3
| 4
| 5
| 6
| undefined
}
): <A extends DateTime.DateTime>(self: A) => A
<A extends DateTime.DateTime>(
self: A,
part: DateTime.DateTime.UnitSingular,
options?: {
readonly weekStartsOn?:
| 0
| 1
| 2
| 3
| 4
| 5
| 6
| undefined
}
): A
}
startOf