@antv/data-wizard
Version:
A js/ts library for data processing
77 lines (76 loc) • 2.11 kB
TypeScript
import { BasicRandom, Interval } from './basic-random';
import { DateTimeDB } from './database';
/**
* Generator for date
* @public
*/
export declare class DateTimeRandom extends BasicRandom {
/**
* return a random date which format is yyyy-MM-dd
*/
database: DateTimeDB;
/**
* return a random full date {@link https://tools.ietf.org/html/rfc3339#section-5.6 | full-date}
* @param options - the params
*/
date(options?: Interval): string;
/**
* return a random full time {@link https://tools.ietf.org/html/rfc3339#section-5.6 | full-time}
* @param options - the params
*/
time(options?: TimeOptions): string;
/**
* return a random date-time (full-data T fulltime) {@link https://tools.ietf.org/html/rfc3339#section-5.6 | date-time}
*
* @remarks
* {@link https://date-fns.org/v2.0.1/docs/format | format}
* @param options - the params
*/
datetime(options?: DateTimeOptions): string;
/**
* return a random timestamp
* @param options - the params
*/
timestamp(options: Interval): number;
/**
* return a random weekday
*
* @example
* ```javascript
* new DateTimeRandom().weekday({ locale: 'zh-CN' }) // 星期一
* new DateTimeRandom().weekday({ abbr: true }) // Mon.
* ```
* @param options - the params
* @public
*/
weekday(options?: WeekDayOptions): string;
/**
* return a random month
*
* @param options - the params
* @public
*/
month(options?: MonthOptions): string;
}
/** @public */
export interface DateTimeOptions extends Interval {
/** the format {@link https://date-fns.org/v2.0.1/docs/format | keyword} */
format?: string;
}
/** @public */
export interface TimeOptions extends Interval {
/** has the UTC time offset */
short?: boolean;
}
declare type Locale = 'en-US' | 'zh-CN';
/** @public */
export interface WeekDayOptions {
locale?: Locale;
abbr?: boolean;
}
/** @public */
export interface MonthOptions {
locale?: Locale;
abbr?: boolean;
}
export {};