-
Notifications
You must be signed in to change notification settings - Fork 27
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
Added support to configure date time format from settings page and updated UI of settings page(#2t2y3qq) #60
Conversation
…on login(#2t2y3qq)
…nd display in dateTime modal(#2t2y3qq)
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.
See comments
…ormat in case format mismatch(#2t2y3qq)
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.
Add comments when formatting the date time using luxon
src/store/modules/user/UserState.ts
Outdated
@@ -3,4 +3,5 @@ export default interface UserState { | |||
current: object | null; | |||
currentFacility: object; | |||
instanceUrl: string; | |||
dateTimeFormat: string; |
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.
dateTimeFormat: string; | |
preferredDateTimeFormat: string; |
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.
Updated variable name.
src/store/modules/user/actions.ts
Outdated
@@ -18,6 +18,7 @@ const actions: ActionTree<UserState, RootState> = { | |||
const resp = await UserService.login(username, password) | |||
if (resp.status === 200 && resp.data) { | |||
if (resp.data.token) { | |||
dispatch('setDateTimeFormat', process.env.VUE_APP_DATE_FORMAT ? process.env.VUE_APP_DATE_FORMAT : 'MM/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.
This is should be done after successful login only, after permission check
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.
Made the requested change.
src/views/OrderDetail.vue
Outdated
@@ -212,6 +213,10 @@ export default defineComponent({ | |||
this.fetchFacilities(); | |||
}, | |||
methods: { | |||
isDateInvalid(){ | |||
// Checked if any of the date format is different than the selected format. | |||
return !this.ordersList.items.some((item: any) => DateTime.fromFormat(item.arrivalDate, this.dateTimeFormat).isValid); |
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 the condition should be inverted while checking items, if any one of the item is invalid it should return
return !this.ordersList.items.some((item: any) => DateTime.fromFormat(item.arrivalDate, this.dateTimeFormat).isValid); | |
return this.ordersList.items.some((item: any) => !DateTime.fromFormat(item.arrivalDate, this.dateTimeFormat).isValid); |
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.
Made the requested change.
Closes #87