/** * External dependencies */ import type { Moment } from 'moment'; import 'moment-timezone/moment-timezone.js'; import 'moment-timezone/moment-timezone-utils.js'; /** * Internal dependencies */ import type { DateSettings } from './types'; export type * from './types'; /** * Adds a locale to moment, using the format supplied by `wp_localize_script()`. * * @param dateSettings Settings, including locale data. */ export declare function setSettings(dateSettings: DateSettings): void; /** * Returns the currently defined date settings. * * @return {DateSettings} Settings, including locale data. */ export declare function getSettings(): DateSettings; /** * Returns the currently defined date settings. * * @deprecated * @return {DateSettings} Settings, including locale data. */ export declare function __experimentalGetSettings(): DateSettings; /** * Formats a date. Does not alter the date's timezone. * * @param dateFormat PHP-style formatting string. * See [php.net/date](https://www.php.net/manual/en/function.date.php). * @param dateValue Date object or string, * parsable by moment.js. * * @return Formatted date. */ export declare function format(dateFormat: string, dateValue?: Moment | Date | string | number): string; /** * Formats a date (like `date()` in PHP). * * @param dateFormat PHP-style formatting string. * See [php.net/date](https://www.php.net/manual/en/function.date.php). * @param dateValue Date object or string, parsable * by moment.js. * @param timezone Timezone to output result in or a * UTC offset. Defaults to timezone from * site. * * @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones * @see https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC * * @return {string} Formatted date in English. */ export declare function date(dateFormat: string, dateValue?: Moment | Date | string | number, timezone?: string): string; /** * Formats a date (like `date()` in PHP), in the UTC timezone. * * @param dateFormat PHP-style formatting string. * See [php.net/date](https://www.php.net/manual/en/function.date.php). * @param dateValue Date object or string, * parsable by moment.js. * * @return Formatted date in English. */ export declare function gmdate(dateFormat: string, dateValue?: Moment | Date | string | number): string; /** * Formats a date (like `wp_date()` in PHP), translating it into site's locale. * * Backward Compatibility Notice: if `timezone` is set to `true`, the function * behaves like `gmdateI18n`. * * @param dateFormat PHP-style formatting string. * See [php.net/date](https://www.php.net/manual/en/function.date.php). * @param dateValue Date object or string, parsable by * moment.js. * @param timezone Timezone to output result in or a * UTC offset. Defaults to timezone from * site. Notice: `boolean` is effectively * deprecated, but still supported for * backward compatibility reasons. * * @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones * @see https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC * * @return Formatted date. */ export declare function dateI18n(dateFormat: string, dateValue?: Moment | Date | string | number, timezone?: string | number | boolean): string; /** * Formats a date (like `wp_date()` in PHP), translating it into site's locale * and using the UTC timezone. * * @param dateFormat PHP-style formatting string. * See [php.net/date](https://www.php.net/manual/en/function.date.php). * @param dateValue Date object or string, * parsable by moment.js. * * @return Formatted date. */ export declare function gmdateI18n(dateFormat: string, dateValue?: Moment | Date | string | number): string; /** * Check whether a date is considered in the future according to the WordPress settings. * * @param dateValue Date String or Date object in the Defined WP Timezone. * * @return Is in the future. */ export declare function isInTheFuture(dateValue: Date | string | number): boolean; /** * Create and return a JavaScript Date Object from a date string in the WP timezone. * * @param dateString Date formatted in the WP timezone. * * @return Date */ export declare function getDate(dateString?: string | null): Date; /** * Returns a human-readable time difference between two dates, like human_time_diff() in PHP. * * @param from From date, in the WP timezone. * @param to To date, formatted in the WP timezone. * * @return Human-readable time difference. */ export declare function humanTimeDiff(from: Moment | Date | string | number, to?: Moment | Date | string | number): string; //# sourceMappingURL=index.d.ts.map