Skip to content

Commit edbc72e

Browse files
committed
Removed accounting package dependency (no longer maintained)
1 parent 8c1606b commit edbc72e

File tree

4 files changed

+13
-25
lines changed

4 files changed

+13
-25
lines changed

package-lock.json

+2-13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@
5858
}
5959
},
6060
"dependencies": {
61-
"accounting": "^0.4.1",
6261
"big.js": "^6.1.1",
6362
"chart.js": "^2.9.4",
6463
"crypto-random-string": "^3.3.1",

src/renderer/components/TransactionList.vue

+1-9
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@
8989

9090
<script>
9191
import moment from 'moment';
92-
import accounting from 'accounting';
9392
import { isAfter, isBefore, parseISO, isSameDay } from 'date-fns';
9493
import Big from 'big.js';
9594
import DateRange from './DateRange.vue';
@@ -209,12 +208,6 @@ export default {
209208
: sum.minus(transaction.value);
210209
}, new Big(0));
211210
},
212-
searchFormatted() {
213-
return {
214-
currency: accounting.unformat(this.search),
215-
date: moment(this.search, this.$dateFormat).format('YYYY-MM-DD'),
216-
};
217-
},
218211
},
219212
watch: {
220213
search() {
@@ -271,8 +264,7 @@ export default {
271264
if (value.toLowerCase().includes(rawSearch.toLowerCase())) return true;
272265
273266
// Then do currency and date
274-
const { currency, date } = this.searchFormatted;
275-
if (currency && value.includes(currency.toString())) return true;
267+
const date = moment(this.search, this.$dateFormat).format('YYYY-MM-DD');
276268
if (date && value.includes(date)) return true;
277269
278270
return false;

src/renderer/main.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import Vue from 'vue';
2-
import accounting from 'accounting';
32
import moment from 'moment';
43

54
import vuetify from './plugins/vuetify';
@@ -82,14 +81,23 @@ Vue.use(history, {
8281
Vue.prototype.$currencyPrefix = currencyPrefix;
8382
Vue.prototype.$dateFormat = dateFormat;
8483

84+
const numberFormat = new Intl.NumberFormat('en-GB', {
85+
style: 'currency',
86+
currency: 'GBP',
87+
});
88+
8589
Vue.filter('currency', (value) => {
8690
if (value === undefined || value === null) {
8791
return '';
8892
}
8993
if (value === 0 && Object.is(value, -0)) {
9094
value = 0;
9195
}
92-
return accounting.formatMoney(value, currencyPrefix, 2, ',', '.');
96+
const formatted = numberFormat.format(value);
97+
98+
return currencyPrefix === '£'
99+
? formatted
100+
: formatted.replace('£', currencyPrefix);
93101
});
94102

95103
Vue.filter('date', (value) =>

0 commit comments

Comments
 (0)