@@ -19,6 +19,7 @@ export interface SerializedTransaction {
1919 isCommitted : boolean ;
2020 description ?: string ;
2121 createdAt : string ; // Date como string JSON
22+ date : string ; // Date como string JSON
2223 categoryId : string | null ;
2324 type : 'expense' | 'income' ;
2425 vaultId : string ;
@@ -121,7 +122,7 @@ export class Vault {
121122 transaction . categoryId = options . categoryId ;
122123 }
123124 if ( options . date !== undefined ) {
124- transaction . createdAt = options . date ;
125+ transaction . date = options . date ;
125126 }
126127
127128 if ( options . type !== undefined ) {
@@ -191,11 +192,9 @@ export class Vault {
191192 transaction . categoryId === categoryId &&
192193 transaction . type === 'expense' &&
193194 ( month
194- ? new Date ( transaction . createdAt ) . getMonth ( ) + 1 === month
195+ ? new Date ( transaction . date ) . getMonth ( ) + 1 === month
195196 : true ) &&
196- ( year
197- ? new Date ( transaction . createdAt ) . getFullYear ( ) === year
198- : true ) ,
197+ ( year ? new Date ( transaction . date ) . getFullYear ( ) === year : true ) ,
199198 )
200199 . reduce (
201200 ( total , transaction ) => total + Math . abs ( transaction . amount ) ,
@@ -235,7 +234,7 @@ export class Vault {
235234 date = { month : now . getMonth ( ) + 1 , year : now . getFullYear ( ) } ;
236235 }
237236
238- const transactionDate = new Date ( transaction . createdAt ) ;
237+ const transactionDate = new Date ( transaction . date ) ;
239238 const transactionMonth = transactionDate . getMonth ( ) + 1 ;
240239 const transactionYear = transactionDate . getFullYear ( ) ;
241240
@@ -255,7 +254,7 @@ export class Vault {
255254 const now = new Date ( ) ;
256255 date = { month : now . getMonth ( ) + 1 , year : now . getFullYear ( ) } ;
257256 }
258- const transactionDate = new Date ( transaction . createdAt ) ;
257+ const transactionDate = new Date ( transaction . date ) ;
259258 const transactionMonth = transactionDate . getMonth ( ) + 1 ;
260259 const transactionYear = transactionDate . getFullYear ( ) ;
261260 if ( transactionMonth === date . month && transactionYear === date . year ) {
@@ -296,6 +295,7 @@ export class Vault {
296295 isCommitted : transaction . isCommitted ,
297296 description : transaction . description ,
298297 createdAt : transaction . createdAt . toISOString ( ) ,
298+ date : transaction . date . toISOString ( ) ,
299299 categoryId : transaction . categoryId ,
300300 type : transaction . type ,
301301 vaultId : transaction . vaultId ,
0 commit comments