@scayle/storefront-core
Version:
Collection of essential utilities to work with the Storefront API
82 lines (81 loc) • 3.12 kB
TypeScript
/**
* Converts a date string from DD.MM.YYYY to YYYY-MM-DD format.
*
* @param date Date string in DD.MM.YYYY format.
*
* @returns Date string in YYYY-MM-DD format, or undefined if input is undefined.
*
* @deprecated Validation should be handled within the Storefront project itself.
*/
export declare const getPayloadDate: (date: string | undefined) => string | undefined;
/**
* Validates a date string in DD.MM.YYYY format.
*
* @param date Date string in DD.MM.YYYY format.
*
* @returns True if the date is valid, false otherwise.
*
* @deprecated Validation should be handled within the Storefront project itself.
*/
export declare const dateValidator: (date: string | undefined) => boolean;
/**
* Formats a date string from YYYY-MM-DD or YYYY-MM-DDThh:mm:ss+xx:yy to DD.MM.YYYY format.
*
* @param date Date string in YYYY-MM-DD or YYYY-MM-DDThh:mm:ss+xx:yy format.
*
* @returns Formatted date string in DD.MM.YYYY format, or an empty string if input is undefined or invalid.
*
* @deprecated Validation should be handled within the Storefront project itself.
*/
export declare const formatDate: (date: string | undefined) => string;
/**
* Formats a date string in DD.MM.YYYY format, adding zero padding to day and month.
*
* @param date Date string in DD.MM.YYYY format.
*
* @returns Formatted date string, or an empty string if input is undefined or invalid.
*
* @deprecated Validation should be handled within the Storefront project itself.
*/
export declare const convertDate: (date: string | undefined) => string;
/**
* Converts a phone number from +00 1234 567890 format to 0000/1234567890 format.
*
* @param phone Phone number in +00 1234 567890 format.
*
* @returns Formatted phone number string, or undefined if input is undefined.
*
* @deprecated Validation should be handled within the Storefront project itself.
*/
export declare const getPayloadPhone: (phone: string | undefined) => string | undefined;
/**
* Validates a phone number in +00 1234 567890 format.
*
* @param phone Phone number string.
*
* @returns True if the phone number is valid, false otherwise.
*
* @deprecated Validation should be handled within the Storefront project itself.
*/
export declare const phoneValidator: (phone: string | undefined) => boolean;
/**
* Formats a phone number from 0000/1234567890 format to +00 1234 567890 format.
*
* @param phone Phone number in 0000/1234567890 format.
*
* @returns Formatted phone number string.
*
* @deprecated Validation should be handled within the Storefront project itself.
*/
export declare const formatPhone: (phone: string | undefined) => string;
/**
* Converts a phone number to +00 1234 567890 format.
*
* @param phone Phone number in unknown format.
* @param internationalPrefix International dial code (defaults to 49 for Germany).
*
* @returns Formatted phone number string, or undefined if input is undefined.
*
* @deprecated Validation should be handled within the Storefront project itself.
*/
export declare const convertPhone: (phone: string | undefined, internationalPrefix?: string) => string | undefined;