OBPIH-6329 Add details step of full outbound import form#4656
OBPIH-6329 Add details step of full outbound import form#4656awalkowiak merged 9 commits intodevelopfrom
Conversation
kchelstowski
commented
Jun 7, 2024

| if (showTimeSelect) { | ||
| return moment(new Date(dateToFormat), DateFormat.MMM_DD_YYYY_HH_MM_SS); | ||
| } | ||
|
|
||
| return moment(new Date(dateToFormat), DateFormat.MMM_DD_YYYY); |
There was a problem hiding this comment.
It can be reduced using ternary operator
There was a problem hiding this comment.
I would say it doesn't reduce much, and it's just a matter of preference, as it's a simple one if statement.
Anyway, changed to ternary.
There was a problem hiding this comment.
I think I would move this component to OuboundImportHeader.jsx, basically this one is short and has no logic, so I don't see any benefits of separating those.
| const getDefaultValues = () => ({ | ||
| description: undefined, | ||
| origin: undefined, | ||
| destination: undefined, | ||
| requestedBy: undefined, | ||
| dateRequested: undefined, | ||
| dateShipped: moment(new Date()).format(DateFormat.MMM_DD_YYYY_HH_MM_SS), | ||
| shipmentType: undefined, | ||
| trackingNumber: undefined, | ||
| comments: undefined, | ||
| expectedDeliveryDate: undefined, | ||
| packingList: undefined, |
There was a problem hiding this comment.
Are those undefined necessary to use these values as defaults?
There was a problem hiding this comment.
For now yeah, the eventual adjustments (if we will even support the "edit" functionality for this feature), should be dealt with in the "integrate backend & frontend" ticket.
src/js/utils/zodUtils.js
Outdated
| import moment from 'moment'; | ||
|
|
||
| /** | ||
| * Method to if picked date is from the future | ||
| * @return true if the date is not from the future; false if the date is from the future | ||
| * @param pickedDate | ||
| */ | ||
| const validateFutureDate = (pickedDate) => { | ||
| const date = moment(pickedDate); | ||
| const today = moment(new Date()); | ||
| return date.startOf('day').isSameOrBefore(today.startOf('day')); | ||
| }; | ||
|
|
||
| export default validateFutureDate; |
There was a problem hiding this comment.
I think I would move it to form-utils.js instead of creating the next "utils" file