DefinitelyTyped/types/javascript-time-ago/index.d.ts
Erik Burton 1f7634ec0d javascript-time-ago type definitions (#40618)
* Adding tsconfig and tslint

* Adding main interface type definitions

* Adding tests

* Updating tsconfig

* Adding locale type definitions

* Fix config

* Fix linting

* Updating tsconfig to use files property

* Updating typescript version

* Header fix

* Trimming newlines for dtslint

* Potential CI Fix

* Removing strict flag from tsconfig

* Shuffling types for less duplication

* Adding newline for linting
2019-11-26 14:30:25 -08:00

28 lines
1.2 KiB
TypeScript

// Type definitions for javascript-time-ago 2.0
// Project: https://github.com/catamphetamine/javascript-time-ago
// Definitions by: Erik Burton <https://github.com/erikburt>
// Henry Nguyen <https://github.com/HenryNguyen5>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { Locale, TimeUnit, Duration, DefaultFormats, RTFFormatter, Formats, QuantifyType } from "./locale";
export = TimeAgo;
declare class TimeAgo {
constructor(locales?: string | string[]);
format(input: Date | number, style?: string): string;
formatNumber(number: number): string;
formatValue(value: Date | number, unit: TimeUnit, localeData: Duration): string;
getFormatter(flavor: DefaultFormats): RTFFormatter;
getLocaleData(format?: Formats): Duration; // Defaults to "long"
getRule(value: Date | number, unit: TimeUnit, localeData: Duration): string;
static addLocale(localeData: Locale): void;
static locale(localeData: Locale): void;
static getDefaultLocale(): string;
static intlDateTimeFormatSupported(): boolean;
static intlDateTimeFormatSupportedLocale(locale: string): string | void;
static setDefaultLocale(locale: string): void;
}