Skip to content

Releases: leekchan/accounting

v0.3.1

06 Aug 07:50
Compare
Choose a tag to compare

🌟 What's New in accounting v0.3.1

  • #17 Proposal: Please start using Semantic Versioning (by @KateGo520)

v0.3

24 Dec 04:16
Compare
Choose a tag to compare

accounting v0.3 includes many contributions. Thank you to all who have contributed in this great work! 🙇

🌟 What's New in accounting v0.3

  • #7 Support github.com/cockroachdb/apd for BigDecimal numbers (by @tamalsaha)
  • #10 Add support for github.com/shopspring/decimal Add support for github.com/shopspring/decimal (by @Dexus)
  • #11 Add Function DefaultAccounting and NewAccounting (by @Dexus)
  • #13 Go modules (by @akkumar)
  • #14 Use formattedNumber to format zero (by @bykof)
  • #15 Locale Info and UnformatNumber (by @djackreuter)

v0.2

11 Dec 14:27
Compare
Choose a tag to compare
  • the default format for negative numbers has been changed
  • 32-bit support

v0.1

22 Aug 05:07
Compare
Choose a tag to compare

big.Float support has been added

ac = accounting.Accounting{Symbol: "$", Precision: 2}
fmt.Println(ac.FormatMoneyBigFloat(big.NewFloat(123456789.213123))) // "$123,456,789.21"
fmt.Println(ac.FormatMoneyBigFloat(big.NewFloat(12345678)))         // "$12,345,678.00"

ac = accounting.Accounting{Symbol: "€", Precision: 2, Thousand: ".", Decimal: ","}
fmt.Println(ac.FormatMoneyBigFloat(big.NewFloat(4999.99)))  // "€4.999,99"
fmt.Println(ac.FormatMoneyBigFloat(big.NewFloat(-4999.99))) // "€-4.999,99"

ac = accounting.Accounting{Symbol: "£ ", Precision: 0}
fmt.Println(ac.FormatMoneyBigFloat(big.NewFloat(-500000))) // "£ -500,000"

ac = accounting.Accounting{Symbol: "GBP", Precision: 0,
    Format: "%s %v", FormatNegative: "%s (%v)", FormatZero: "%s --"}
fmt.Println(ac.FormatMoneyBigFloat(big.NewFloat(1000000))) // "GBP 1,000,000"
fmt.Println(ac.FormatMoneyBigFloat(big.NewFloat(-5000)))   // "GBP (5,000)"
fmt.Println(ac.FormatMoneyBigFloat(big.NewFloat(0)))       // "GBP --"