heartinz_essentials 3.4.0
heartinz_essentials: ^3.4.0 copied to clipboard
Essentials provides a set of ready-to-use tools for calculations, date and time manipulations, currency conversions, and GST (tax) computations, making it an all-in-one solution for developers
3.4.0 - 2026-07-28 #
Added #
- New
discountmodule (ported from@heartinz/finance):distributeDiscount()spreads a total discount across a list of amounts proportionally using the largest-remainder method, anddistributeDiscountToItems()distributes a discount across line items and reconciles rounding drift, withmodel_discount.dartresult models.
3.3.0 - 2026-07-17 #
Added #
- New
returnPricemodule (ported from@heartinz/finance):getReturnAmountList()calculates the return price breakdown for a return line item, andgetReturnGrandTotal()calculates the grand total for the total return amounts, withmodel_return_price_calculations.dartresult models.
3.2.0 - 2026-07-13 #
Added #
- New
offermodule (ported from@heartinz/finance):getOfferAmount()calculates the final amount after applying an offer percent discount, andgetOfferPercent()calculates the discount percent between an mrp and salePrice.
3.1.2 - 2026-06-12 #
Added #
- New
purchasemodule:getPurchaseAmount()andgetPurchaseGrandTotal()for purchase price/tax breakdowns, withmodel_purchase.dartresult models. - Exported
normalizeConfig()for normalizingUnitConfiginstances.
Fixed #
_capitalizeinGrandTotalnow capitalizes each word instead of only the first.
3.1.0 - 2026-04-21 #
Added #
- Organized Essentials class with sub-modules for better API structure:
calcmodule:calculateGrandTotal(),gstCalculate(),findGstAmountSplit()currencymodule:toCurrency(),toSubunit()datemodule: All date/time operations (displayIso(),toTimeZone(), etc.)unitmodule: Unit conversion operations (toPrimaryQuantity(),toSecondaryQuantity(),toPrimaryUnitPrice(),toSecondaryUnitPrice())
- New unit conversion functions following unit_new_reference.js specification
- Price conversion functions for unit transformations
Changed #
- Refactored API structure: All functions now accessible via sub-modules (e.g.,
essentials.calc.calculateGrandTotal()) - Updated UnitConfig to support optional secondary units
- Enhanced unit conversion with proper validation and normalization
Breaking Changes #
- Direct access to functions has changed. Use sub-module pattern instead:
- Old:
essentials.calculateGrandTotal() - New:
essentials.calc.calculateGrandTotal()
- Old:
3.1.1 - 2026-04-27 #
Fixed #
-
Ensure
unitScaleacceptsDecimaland avoid assertion on non-terminating divisions by usingscaleOnInfinitePrecisionwhere needed. -
Adjusted unit conversion examples and tests to pass
Decimalvalues. -
Minor precision/rounding fixes in
gstand unit calculations. -
New Split Function
Fixed #
- Fixed bugs related to date handling.
- Corrected rounding errors during calculations.
- Removed unwanted exports