Skip to content

Commit

Permalink
Merge pull request #28 from disha1202/#24gtujf
Browse files Browse the repository at this point in the history
Updated the code to make date format configurable through env file(#24gtujf)
  • Loading branch information
adityasharma7 authored Mar 31, 2022
2 parents 11df5e0 + 1e62fdd commit 41f9940
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ VUE_APP_I18N_FALLBACK_LOCALE=en
VUE_APP_CACHE_MAX_AGE=3600
VUE_APP_VIEW_SIZE=10
VUE_APP_SECURITY_KEY=VUE_APP_SECURITY_KEY
VUE_APP_DATE_FORMAT=MM/dd/yyyy
6 changes: 6 additions & 0 deletions changelogs/unreleased/-24gtujf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Updated the code to make date format configurable through env file
ticket_id: "#24gtujf"
merge_request: 28
author: Disha Talreja
type: performance
2 changes: 2 additions & 0 deletions src/store/modules/order/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import RootState from '@/store/RootState'
import OrderState from './OrderState'
import * as types from './mutation-types'
import router from '@/router'
import { DateTime } from 'luxon';


const actions: ActionTree<OrderState, RootState> = {
Expand All @@ -23,6 +24,7 @@ const actions: ActionTree<OrderState, RootState> = {
const product = products.find((product: any) => {
return item.shopifyProductSKU == product.internalName;
})
item.arrivalDate = DateTime.fromFormat(item.arrivalDate, "D").toFormat(process.env.VUE_APP_DATE_FORMAT ? process.env.VUE_APP_DATE_FORMAT : 'MM/dd/yyyy' );
item.parentProductId = product.groupId;
item.internalName = product.internalName;
item.parentProductName = product.parentProductName;
Expand Down
2 changes: 1 addition & 1 deletion src/views/OrderDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ export default defineComponent({
this.ordersList.items.map((item: any) => {
if (item.isSelected) {
item.quantityOrdered -= this.numberOfPieces;
item.arrivalDate = DateTime.fromFormat(item.arrivalDate, "D").plus({ days: this.numberOfDays }).toFormat('MM/dd/yyyy');
item.arrivalDate = DateTime.fromFormat(item.arrivalDate, process.env.VUE_APP_DATE_FORMAT ? process.env.VUE_APP_DATE_FORMAT : 'MM/dd/yyyy').plus({ days: this.numberOfDays }).toFormat(process.env.VUE_APP_DATE_FORMAT ? process.env.VUE_APP_DATE_FORMAT : 'MM/dd/yyyy');
item.isNewProduct = this.catalog;
if(this.facilityId) {
item.facilityId = this.facilityId;
Expand Down

0 comments on commit 41f9940

Please sign in to comment.