[+] Create method to format string length
This commit is contained in:
@@ -15,4 +15,15 @@ export class FormatUtils
|
|||||||
// Convert to yyyy-mm-dd
|
// Convert to yyyy-mm-dd
|
||||||
return moment(date).format('YYYY-MM-DD');
|
return moment(date).format('YYYY-MM-DD');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Limit string length
|
||||||
|
*
|
||||||
|
* @param str String
|
||||||
|
* @param length Max length
|
||||||
|
*/
|
||||||
|
static limit(str: string, length: number): string
|
||||||
|
{
|
||||||
|
return str.length <= length ? str : str.substr(0, length - 2) + '...'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user