Make ynab export equivalent to original export #21

Merged
jacob1123 merged 7 commits from ynab-export-fixes into master 2022-02-25 16:35:18 +01:00
5 changed files with 90 additions and 23 deletions
Showing only changes of commit 79c0fceafe - Show all commits

View File

@ -129,7 +129,11 @@ func (n Numeric) String() string {
exp = -exp exp = -exp
for length <= exp { for length <= exp {
bytes = append([]byte{byte('0')}, bytes...) if n.Int.Int64() < 0 {
bytes = append([]byte{bytes[0], byte('0')}, bytes[1:]...)
} else {
bytes = append([]byte{byte('0')}, bytes...)
}
length++ length++
} }
@ -166,7 +170,11 @@ func (n Numeric) MarshalJSON() ([]byte, error) {
exp = -exp exp = -exp
for length <= exp { for length <= exp {
bytes = append([]byte{byte('0')}, bytes...) if n.Int.Int64() < 0 {
bytes = append([]byte{bytes[0], byte('0')}, bytes[1:]...)
} else {
bytes = append([]byte{byte('0')}, bytes...)
}
length++ length++
} }