Liquidjs divided_by not compatible with Ruby/Shopify Liquid
See original GitHub issuehttps://shopify.github.io/liquid/filters/divided_by/
The result is rounded down to the nearest integer (that is, the floor) if the divisor is an integer.Input
{{ 16 | divided_by: 4 }} => 4
{{ 5 | divided_by: 3 }} => 1
Liquidjs:
{{ 5 | divided_by: 3 }} => 1.6666666666666667
Issue Analytics
- State:
- Created 2 years ago
- Comments:12 (11 by maintainers)
Top Results From Across the Web
Differences with Shopify/liquid - LiquidJS
Though we're trying to be compatible with the Ruby version, there are still some differences: Truthy and Falsy. All values except undefined , ......
Read more >Can't calculate a percentage because divided_by rounds #831
Hey folks, I'm trying to calculate a percentage using liquid and, to my surprise ... If you divided by an integer, the result...
Read more >divided_by – Liquid template language
Menu. divided_by. Divides a number by another number. The result is rounded down to the nearest integer (that is, the floor) if the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Okay. There’s no way to fix it on the filter level. We’d have to detect
5.0
on the parsing stage, and use our own wrapping type to differentiate between float and integer. I’m not that good with JavaScript to do it for you.Supported another argument to enable integer arithmetic: