plainDateISO
Returns the current date as a Temporal.PlainDate object, in the ISO 8601 calendar and the specified time zone.
When time_zone_like is null, the system time zone is used.
Parameters
- allocator:std.mem.Allocator
- std.mem.Allocator
- io:std.Io
- std.Io
- time_zone_like:?[]const u8
- ?[]const u8
Source
Implementation
pub fn plainDateISO(allocator: std.mem.Allocator, io: std.Io, time_zone_like: ?[]const u8) !PlainDate {
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_PlainDate_from_epoch_nanoseconds(
abi.toI128Nanoseconds(now.epochNanoseconds()),
abi.to.toTimeZone(time_zone),
))) orelse return abi.TemporalError.Generic;
return .{ ._inner = ptr };
}