@docsvision/webclient
Version:
Type definitions for DocsVision WebClient scripts and extensions.
48 lines (47 loc) • 3.43 kB
TypeScript
import { DateFormats } from "@docsvision/webclient/System/DateFormats";
import moment from "moment";
import { $ApplicationSettings } from '@docsvision/webclient/StandardServices';
/**
* Возвращает порядковый номер дня в году для указанной даты.
*
* https://stackoverflow.com/questions/8619879/javascript-calculate-the-day-of-the-year-1-366
*/
export declare function getDayOfYear(date: Date): number;
export declare function toShortDateString(dateTime: Date | string, services: $ApplicationSettings): string;
export declare function toLongDateString(dateTime: Date | string, services: $ApplicationSettings): string;
export declare function toShortTimeString(dateTime: Date | string, services: $ApplicationSettings): string;
export declare function toLongTimeString(dateTime: Date | string, services: $ApplicationSettings): string;
export declare function toShortDateTimeString(dateTime: Date | string, services: $ApplicationSettings): string;
export declare function toDateWithMonthStringShortTimeString(dateTime: Date | string, services: $ApplicationSettings): string;
export declare function toLongDateTimeString(dateTime: Date | string, services: $ApplicationSettings): string;
export declare function toServerDateString(dateTime: Date | string, services: $ApplicationSettings): string;
/** Преобразует строку в дату с конвертацией временной зоны. */
export declare function parseServerDateTime(dateTime: string): Date;
export declare function toDate(dateTime: string): Date;
/** Преобразует часы в милисекунды. */
export declare function hoursToMs(hours: number): number;
/** Преобразует милисекунды в часы с округлением. */
export declare function msToHours(ms: number): number;
export declare function validDate(date: Date | string): boolean;
/**
* @deprecated
* Используйте {@see toShortDateString}, {@see toLongDateString}, {@see toShortTimeString}, {@see toLongTimeString}, {@see toShortDateTimeString},
* {@see toShortDateTimeString}, {@see toLongDateTimeString}, {@see toDateWithMonthStringShortTimeString}, {@see toServerDateString}
*/
export declare function formatDateTime(dateTime: Date | string, format?: DateFormats): string;
/**
* Конвертирует строку в дату.
* @deprecated Используйте {@see parseServerDateTime}
*
*/
export declare function parseDateTime(dateTime: string, format?: DateFormats, asMoment?: boolean): Date | moment.Moment | null;
/**
* @deprecated
* Используйте {@see toShortDateString}, {@see toLongDateString}, {@see toShortTimeString}, {@see toLongTimeString}, {@see toShortDateTimeString},
* {@see toShortDateTimeString}, {@see toLongDateTimeString}, {@see toDateWithMonthStringShortTimeString}, {@see toServerDateString}
*/
export declare function dateTimeToString(dateTime: Date | string, format?: DateFormats): string;
/** Количество часов в одном дне */
export declare const HOURS_IN_DAY = 24;
/** Возвращает функцию, которую можно передать в JSON.strinfiy вторым параметром для фомрматирования дат для сервера. */
export declare function getDateTimeStringifyServerFormatter(services: $ApplicationSettings): (key: string, value: any) => any;