UNPKG

@microsoft/kiota-abstractions

Version:

Core abstractions for kiota generated libraries in TypeScript and JavaScript

71 lines 2.25 kB
/** * ------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. * See License in the project root for license information. * ------------------------------------------------------------------------------------------- */ /** * Represents a date only. ISO 8601. */ export declare class DateOnly implements DateOnlyInterface { /** * Creates a new DateOnly from the given string. * @param root0 The year, month, and day * @param root0.year The year * @param root0.month The month * @param root0.day The day * @returns The new DateOnly * @throws An error if the year is invalid * @throws An error if the month is invalid * @throws An error if the day is invalid */ constructor({ year, month, day }: Partial<DateOnlyInterface>); year: number; month: number; day: number; /** * Creates a new DateOnly from the given date. * @param date The date * @returns The new DateOnly * @throws An error if the date is invalid */ static fromDate(date: Date): DateOnly; /** * Parses a string into a DateOnly. The string can be of the ISO 8601 time only format or a number representing the ticks of a Date. * @param value The value to parse * @returns The parsed DateOnly. * @throws An error if the value is invalid */ static parse(value: string | undefined): DateOnly | undefined; /** * Returns a string representation of the date in the format YYYY-MM-DD * @returns The date in the format YYYY-MM-DD ISO 8601 */ toString(): string; } interface DateOnlyInterface { /** * The year * @default 0 */ year: number; /** * The month * @default 1 */ month: number; /** * The day * @default 1 */ day: number; } /** * Formats a segment of a date to a string * @param segment The segment to format * @param digits The number of digits to pad * @returns The formatted segment */ export declare function formatSegment(segment: number, digits?: number): string; export {}; //# sourceMappingURL=dateOnly.d.ts.map