@sap_oss/wdio-qmate-service
Version:
[](https://api.reuse.software/info/github.com/SAP/wdio-qmate-service)[](http
86 lines (85 loc) • 4.64 kB
TypeScript
import { CalculateDatesType } from "./types/date.types";
import { DateFormatsType } from "../util/types/formatter.types";
/**
* @class date
* @memberof common
*/
export declare class DateModule {
private vlf;
/**
* @function getToday
* @memberOf common.date
* @description Returns the current day in the given format.
* @param {String} [format="object"] - The expected format ("mm/dd/yyyy", "dd.mm.yyyy", "dd/mm/yyyy", "yyyymmdd", "yyyy/mm/dd", "mmm dd, yyyy", "datetime", "object").
* @returns {String} The date in the given format.
* @example const date = await common.date.getToday("mm/dd/yyyy");
*/
getToday(format?: DateFormatsType): Date | string;
/**
* @function getTomorrow
* @memberOf common.date
* @description Returns tomorrows date in the given format.
* @param {String} [format="object"] - The expected format ("mm/dd/yyyy", "dd.mm.yyyy", "dd/mm/yyyy", "yyyymmdd", "yyyy/mm/dd", "mmm dd, yyyy", "datetime", "object").
* @returns {String} The date in the given format.
* @example const date = await common.date.getTomorrow("mm/dd/yyyy");
*/
getTomorrow(format?: DateFormatsType): Date | string;
/**
* @function getNextMonth
* @memberOf common.date
* @description Returns the current day one month later in the given format.
* @param {String} [format="object"] - The expected format ("mm/dd/yyyy", "dd.mm.yyyy", "dd/mm/yyyy", "yyyymmdd", "yyyy/mm/dd", "mmm dd, yyyy", "datetime", "object").
* @returns {String} The date in the given format.
* @example const date = await common.date.getNextMonth("mm/dd/yyyy");
*/
getNextMonth(format?: DateFormatsType): Date | string;
/**
* @function getPreviousMonth
* @memberOf common.date
* @description Returns the current day one month before in the given format.
* @param {String} [format="object"] - The expected format ("mm/dd/yyyy", "dd.mm.yyyy", "dd/mm/yyyy", "yyyymmdd", "yyyy/mm/dd", "mmm dd, yyyy", "datetime", "object").
* @returns {String} The date in the given format.
* @example const date = await common.date.getPreviousMonth("mm/dd/yyyy");
*/
getPreviousMonth(format?: DateFormatsType): Date | string;
/**
* @function getNextYear
* @memberOf common.date
* @description Returns the current day one year later in the given format.
* @param {String} [format="object"] - The expected format ("mm/dd/yyyy", "dd.mm.yyyy", "dd/mm/yyyy", "yyyymmdd", "yyyy/mm/dd", "mmm dd, yyyy", "datetime", "object").
* @returns {String} The date in the given format.
* @example const date = await common.date.getNextYear("mm/dd/yyyy");
*/
getNextYear(format?: DateFormatsType): Date | string;
/**
* @function getPreviousYear
* @memberOf common.date
* @description Returns the current day one year before in the given format.
* @param {String} [format="object"] - The expected format ("mm/dd/yyyy", "dd.mm.yyyy", "dd/mm/yyyy", "yyyymmdd", "yyyy/mm/dd", "mmm dd, yyyy", "datetime", "object").
* @returns {String} The date in the given format.
* @example const date = await common.date.getPreviousYear("mm/dd/yyyy");
*/
getPreviousYear(format?: DateFormatsType): Date | string;
/**
* @function getSpecific
* @memberOf common.date
* @description Returns a specific date in the given format.
* @param {String} date - A specific date string.
* @param {String} [format="object"] - The expected format ("mm/dd/yyyy", "dd.mm.yyyy", "dd/mm/yyyy", "yyyymmdd", "yyyy/mm/dd", "mmm dd, yyyy", "datetime", "object").
* @returns {String} The date in the given format.
* @example const date = await common.date.getSpecific("2020, 0, 17", "mm/dd/yyyy");
*/
getSpecific(date: string, format?: DateFormatsType): Date | string;
/**
* @function calculate
* @memberOf common.date
* @description Calculates the date based on the input parameter and returns it in the given format.
* @param {String} [date="today"] - Supported values: today, tomorrow, nextMonth, previousMonth, nextYear, previousYear
* @param {String} [format="object"] - The expected format ("mm/dd/yyyy", "dd.mm.yyyy", "dd/mm/yyyy", "yyyymmdd", "yyyy/mm/dd", "mmm dd, yyyy", "mmm d, yyyy", "datetime", "object").
* @returns {String} The calculated date in the given format.
* @example const date = await common.date.calculate("today", "mm/dd/yyyy");
*/
calculate(date?: CalculateDatesType, format?: DateFormatsType): Date | string;
}
declare const _default: DateModule;
export default _default;