mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-3384] Create automated tests for Version Component (#3631)
* fix version component restore and delete event * version manager actions * fix test * fix unit test * remove fdescribe * fix tslint * fix screenshot rewrite problem * remove fdescribe * multi instance try * remove fdescribe * try uncomment some test * error page * fix user preferences pagiantion * search page test include * fix type tslint e2e * restore code * default lang momentadapter * fix test * [ADF-3384] removed console log from test * [ADF-3384] adding some fixes for tests and code * [ADF-3384] fixed some test and code
This commit is contained in:
committed by
Eugenio Romano
parent
17074478e2
commit
a12662e7e2
@@ -89,7 +89,8 @@ export class MomentDateAdapter extends DateAdapter<Moment> {
|
||||
}
|
||||
|
||||
clone(date: Moment): Moment {
|
||||
return date.clone().locale(this.locale);
|
||||
let locale = this.locale || 'en';
|
||||
return date.clone().locale(locale);
|
||||
}
|
||||
|
||||
createDate(year: number, month: number, date: number): Moment {
|
||||
@@ -97,16 +98,18 @@ export class MomentDateAdapter extends DateAdapter<Moment> {
|
||||
}
|
||||
|
||||
today(): Moment {
|
||||
return moment().locale(this.locale);
|
||||
let locale = this.locale || 'en';
|
||||
return moment().locale(locale);
|
||||
}
|
||||
|
||||
parse(value: any, parseFormat: any): Moment {
|
||||
let locale = this.locale || 'en';
|
||||
|
||||
if (value && typeof value === 'string') {
|
||||
let m = moment(value, parseFormat, this.locale, true);
|
||||
let m = moment(value, parseFormat, locale, true);
|
||||
if (!m.isValid()) {
|
||||
// use strict parsing because Moment's parser is very forgiving, and this can lead to undesired behavior.
|
||||
m = moment(value, this.overrideDisplyaFormat, this.locale, true);
|
||||
m = moment(value, this.overrideDisplyaFormat, locale, true);
|
||||
}
|
||||
if (m.isValid()) {
|
||||
// if user omits year, it defaults to 2001, so check for that issue.
|
||||
@@ -123,7 +126,7 @@ export class MomentDateAdapter extends DateAdapter<Moment> {
|
||||
return m;
|
||||
}
|
||||
|
||||
return value ? moment(value).locale(this.locale) : null;
|
||||
return value ? moment(value).locale(locale) : null;
|
||||
}
|
||||
|
||||
format(date: Moment, displayFormat: any): string {
|
||||
@@ -204,7 +207,8 @@ export class MomentDateAdapter extends DateAdapter<Moment> {
|
||||
}
|
||||
|
||||
fromIso8601(iso8601String: string): Moment | null {
|
||||
let d = moment(iso8601String, moment.ISO_8601).locale(this.locale);
|
||||
let locale = this.locale || 'en';
|
||||
let d = moment(iso8601String, moment.ISO_8601).locale(locale);
|
||||
return this.isValid(d) ? d : null;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user