TemporalZ

plainDateTimeISO

Returns the current date and time as a Temporal.PlainDateTime object, in the ISO 8601 calendar and the specified time zone.

When time_zone_like is null, the system time zone is used.

See: Temporal.Now.plainDateTimeISO

Parameters

#
allocator:std.mem.Allocator
std.mem.Allocator
io:std.Io
std.Io
time_zone_like:?[]const u8
?[]const u8

Source

Implementation

#
pub fn plainDateTimeISO(allocator: std.mem.Allocator, io: std.Io, time_zone_like: ?[]const u8) !PlainDateTime {
    const time_zone = try resolveTimeZone(allocator, io, time_zone_like);
    const now = try instant(io);
    defer now.deinit();

    const ptr = (try abi.extractResult(abi.c.temporal_rs_PlainDateTime_from_epoch_nanoseconds(
        abi.toI128Nanoseconds(now.epochNanoseconds()),
        abi.to.toTimeZone(time_zone),
    ))) orelse return abi.TemporalError.Generic;
    return .{ ._inner = ptr };
}