UNPKG

@dfinity/utils

Version:

A collection of utilities and constants for NNS/SNS projects.

39 lines (38 loc) 1.28 kB
export interface I18nSecondsToDuration { year: string; year_plural: string; month: string; month_plural: string; day: string; day_plural: string; hour: string; hour_plural: string; minute: string; minute_plural: string; second: string; second_plural: string; } /** * Convert seconds to a human-readable duration, such as "6 days, 10 hours." * @param {Object} options - The options object. * @param {bigint} options.seconds - The number of seconds to convert. * @param {I18nSecondsToDuration} [options.i18n] - The i18n object for customizing language and units. Defaults to English. * @returns {string} The human-readable duration string. */ export declare const secondsToDuration: ({ seconds, i18n, }: { seconds: bigint; i18n?: I18nSecondsToDuration; }) => string; /** * Returns the current timestamp in nanoseconds as a `bigint`. * * @returns {bigint} The current timestamp in nanoseconds. */ export declare const nowInBigIntNanoSeconds: () => bigint; /** * Converts a given `Date` object to a timestamp in nanoseconds as a `bigint`. * * @param {Date} date - The `Date` object to convert. * @returns {bigint} The timestamp in nanoseconds. */ export declare const toBigIntNanoSeconds: (date: Date) => bigint;