Files
social-media/frontend/src/models/userTransactionsModel.js
2025-01-15 15:24:17 -05:00

23 lines
620 B
JavaScript

export default class UserTransactionsModel
{
amount = "";
currency = "";
tipMessage = "";
created = "";
static createFromApiResult(apiResult){
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;
}
}