mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
[APPS-2226] updated date util file
This commit is contained in:
@@ -15,15 +15,16 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import * as moment from 'moment';
|
||||
import { addDays } from 'date-fns';
|
||||
import { DateFnsUtils } from '../../../../../../core/src/lib/common/utils/date-fns-utils';
|
||||
|
||||
export class DateUtil {
|
||||
|
||||
static formatDate(dateFormat: string, date: Date = new Date(), days: number | string = 0): string {
|
||||
return moment(date).add(days, 'days').format(dateFormat);
|
||||
static formatDate(dateFormat: string, date: Date = new Date(), days: number = 0): string {
|
||||
return DateFnsUtils.formatDate(addDays(date, days), dateFormat);
|
||||
}
|
||||
|
||||
static parse(date: string, dateFormat: string = 'DD-MM-YY'): Date {
|
||||
return moment(date, dateFormat).toDate();
|
||||
return DateFnsUtils.parseDate(date, dateFormat);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user