-
-
Notifications
You must be signed in to change notification settings - Fork 399
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
OBPIH-6329 Add details step of full outbound import form #4656
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can be reduced using ternary operator
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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.
Removed
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are those undefined
necessary to use these values as defaults?
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I would move it to form-utils.js
instead of creating the next "utils" file