-
Notifications
You must be signed in to change notification settings - Fork 268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ACS-5857] Moment to Date-Fns Migration for adfMomentDate Pipe. #8924
Changes from all commits
b388cb5
9fc4c97
b94591e
8c1e5c9
ec2d09a
621b05e
5a25ea8
55baa94
d176691
2dd0e0d
6877adb
61f8e12
b0b0ffb
0dffbe4
6404481
2cc6f6c
27dbd03
f41a090
4b8dd3e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ | |
* limitations under the License. | ||
*/ | ||
|
||
import { DateFnsUtils } from '../../../../common/utils/date-fns-utils'; | ||
import { ErrorMessageModel } from './error-message.model'; | ||
import { FormFieldOption } from './form-field-option'; | ||
import { FormFieldTypes } from './form-field-types'; | ||
|
@@ -35,7 +36,6 @@ import { | |
} from './form-field-validator'; | ||
import { FormFieldModel } from './form-field.model'; | ||
import { FormModel } from './form.model'; | ||
declare let moment: any; | ||
|
||
describe('FormFieldValidator', () => { | ||
describe('RequiredFieldValidator', () => { | ||
|
@@ -708,7 +708,7 @@ describe('FormFieldValidator', () => { | |
|
||
it('should take into account that max value is in UTC and NOT fail validating value checking the time', () => { | ||
const maxValueFromActivitiInput = '31-3-2018 12:00 AM'; | ||
const maxValueSavedInForm = moment(maxValueFromActivitiInput, 'DD-M-YYYY hh:mm A').utc().format(); | ||
const maxValueSavedInForm = DateFnsUtils.parseDate(maxValueFromActivitiInput, 'DD-M-YYYY hh:mm A').toISOString(); | ||
|
||
const localValidValue = '2018-3-30 11:59 PM'; | ||
|
||
|
@@ -723,7 +723,7 @@ describe('FormFieldValidator', () => { | |
|
||
it('should take into account that max value is in UTC and fail validating value checking the time', () => { | ||
const maxValueFromActivitiInput = '31-3-2018 12:00 AM'; | ||
const maxValueSavedInForm = moment(maxValueFromActivitiInput, 'DD-M-YYYY hh:mm A').utc().format(); | ||
const maxValueSavedInForm = DateFnsUtils.parseDate(maxValueFromActivitiInput, 'DD-M-YYYY hh:mm A').toISOString(); | ||
|
||
const localInvalidValue = '2018-3-31 12:01 AM'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. modifying server related value There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We changed this to accomodate the suggested parseISO() approach used in form-field-model.ts e6e0b27#diff-231637c71df1cd50fe2ef9ba319639d7eeb28657b17f552fc979be0b9f508cd0R357. We were not attempting to change the data here, but parsing it so that it's compatible with .ts logic. In the previous approach where we were using parseDate(), where we did not need any changes in the test case e6e0b27#diff-231637c71df1cd50fe2ef9ba319639d7eeb28657b17f552fc979be0b9f508cd0L357 upon revisiting this I think, the previous approach was better as no modifications were needed in the test case then. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
|
@@ -833,7 +833,7 @@ describe('FormFieldValidator', () => { | |
|
||
it('should take into account that min value is in UTC and NOT fail validating value checking the time', () => { | ||
const minValueFromActivitiInput = '02-3-2018 06:00 AM'; | ||
const minValueSavedInForm = moment(minValueFromActivitiInput, 'DD-M-YYYY hh:mm A').utc().format(); | ||
const minValueSavedInForm = DateFnsUtils.parseDate(minValueFromActivitiInput, 'DD-M-YYYY hh:mm A').toISOString(); | ||
|
||
const localValidValue = '2018-3-02 06:01 AM'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the test data should not be changed, it's the activity form field model... the purpose of validator is to do the magic inside and validate what's coming into... |
||
|
||
|
@@ -848,7 +848,7 @@ describe('FormFieldValidator', () => { | |
|
||
it('should take into account that min value is in UTC and fail validating value checking the time', () => { | ||
const minValueFromActivitiInput = '02-3-2018 06:00 AM'; | ||
const minValueSavedInForm = moment(minValueFromActivitiInput, 'DD-M-YYYY hh:mm A').utc().format(); | ||
const minValueSavedInForm = DateFnsUtils.parseDate(minValueFromActivitiInput, 'DD-M-YYYY hh:mm A').toISOString(); | ||
|
||
const localInvalidValue = '2018-3-02 05:59 AM'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. modified test data |
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are again changing the test data coming from backend, do not touch this value