Merged PR 58: #42 formatting date
#42 formatting date Related work items: #42
This commit is contained in:
@@ -71,7 +71,7 @@
|
|||||||
</v-row>
|
</v-row>
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
|
|
||||||
<v-data-table-virtual :headers="headers" :items="currentUser.userTransactions" height="250"
|
<v-data-table-virtual fixed-header :headers="headers" :items="currentUser.userTransactions" height="250"
|
||||||
item-value="name">
|
item-value="name">
|
||||||
</v-data-table-virtual>
|
</v-data-table-virtual>
|
||||||
|
|
||||||
@@ -146,9 +146,8 @@ const currentUserName = ref("INVITÉ");
|
|||||||
let currentUser = null;
|
let currentUser = null;
|
||||||
|
|
||||||
const headers = ref([
|
const headers = ref([
|
||||||
{ title: 'Transaction', value: 'index', width: '10%' },
|
{ title: 'Montant', value: 'amount', width: '20%', key: "amount" },
|
||||||
{ title: 'Montant', value: 'amount', width: '10%' },
|
{ title: 'Date', value: 'created', width: '20%', key: "created" },
|
||||||
{ title: 'Date', value: 'created', width: '10%' },
|
|
||||||
{ title: 'Message', value: 'tipMessage', width: '60%' }
|
{ title: 'Message', value: 'tipMessage', width: '60%' }
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|||||||
@@ -7,9 +7,18 @@ export default class MyUserModel
|
|||||||
lastName = "";
|
lastName = "";
|
||||||
userName = "";
|
userName = "";
|
||||||
totalBalance = "";
|
totalBalance = "";
|
||||||
userTransactions = new UserTransactionsModel()
|
userTransactions = [];
|
||||||
|
|
||||||
static createFromApiResult(apiResult){
|
static createFromApiResult(apiResult){
|
||||||
return Object.assign(new MyUserModel(), apiResult);
|
const userModel = Object.assign(new MyUserModel(), apiResult);
|
||||||
|
|
||||||
|
const notMapperTransaction = Object.freeze(userModel.userTransactions);
|
||||||
|
userModel.userTransactions = [];
|
||||||
|
|
||||||
|
for (const transaction of notMapperTransaction) {
|
||||||
|
userModel.userTransactions.push(UserTransactionsModel.createFromApiResult(transaction))
|
||||||
|
}
|
||||||
|
|
||||||
|
return userModel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,18 @@ export default class UserTransactionsModel
|
|||||||
created = "";
|
created = "";
|
||||||
|
|
||||||
|
|
||||||
createFromApiResult(apiResult){
|
static createFromApiResult(apiResult){
|
||||||
return Object.assign(apiResult, new UserTransactionsModel())
|
const userTransactionModel = Object.assign(new UserTransactionsModel(), apiResult)
|
||||||
|
|
||||||
|
const date = new Date(userTransactionModel.created);
|
||||||
|
const options = {
|
||||||
|
year: 'numeric',
|
||||||
|
month: 'long',
|
||||||
|
day: 'numeric',
|
||||||
|
timeZone: 'America/Montreal'
|
||||||
|
};
|
||||||
|
userTransactionModel.created = new Intl.DateTimeFormat('fr-CA', options).format(date);
|
||||||
|
|
||||||
|
return userTransactionModel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user