Skip to content

Conversation

@gustawdaniel
Copy link
Contributor

@gustawdaniel gustawdaniel commented May 1, 2020

In this pull request packages are updated:

 fecha                       ^3.0.3  →   ^4.2.0 
 iconv-lite                  ^0.5.0  →   ^0.5.1 
 jschardet                   ^2.1.0  →   ^2.1.1 
 eslint                      ^6.0.1  →   ^6.8.0 
 eslint-config-airbnb-base  ^14.0.0  →  ^14.1.0 
 eslint-plugin-import       ^2.16.0  →  ^2.20.2 
 mocha                       ^6.0.1  →   ^7.1.2 

Support for multi accounts files was added.
Support for single account files was not changed.

Structure of single account json:

{
  type: 'Bank',
  transactions: [
    {
      date: '2010-03-03T00:00:00',
      amount: -379,
      payee: 'SOME £$™€ CHARACTERS'
    }
  ]
}

Structure of multi account json:

{
  "accounts": [
    {
      "name": "Alior GBP",
      "type": "Bank"
    },
    {
      "name": "Revolut USD",
      "type": "Bank"
    }
  ],
  "transactions": [
    {
      "date": "2010-03-03T00:00:00",
      "amount": -379,
      "payee": "CITY OF SPRINGFIELD",
      "account": "Alior GBP"
    },
    {
      "date": "2010-04-03T00:00:00",
      "amount": -20.28,
      "payee": "YOUR LOCAL SUPERMARKET",
      "account": "Alior GBP"
    },
    {
      "date": "2010-03-03T00:00:00",
      "amount": -421.35,
      "payee": "SPRINGFIELD WATER UTILITY",
      "account": "Alior GBP"
    },
    {
      "date": "2016-05-31T00:00:00",
      "payee": "Authorization sms",
      "amount": -0.2,
      "category": "Services",
      "subcategory": "Financial",
      "account": "Revolut USD"
    }
  ]
}

Copy link
Owner

@spmason spmason left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look mostly fine, thanks for contributing. There's just some cleanup to do and I think the date-format-guessing needs to be removed


function parseDate(dateStr, formats) {
if (formats === 'us') {
if (formats === 'us' || dateStr.includes("'")) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems a bit risky to say that any dateStr that includes a ' is a US date format

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any better proposition? This code do not breaks compatibility but is open also for other date format, that I am using.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per #26 you can pass in a dateFormat option to control how the dates are parsed. us is only supported for backward compatibility

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants