Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metric <-> imperial conversions? #4

Open
danielbachhuber opened this issue Feb 4, 2019 · 7 comments
Open

Metric <-> imperial conversions? #4

danielbachhuber opened this issue Feb 4, 2019 · 7 comments

Comments

@danielbachhuber
Copy link
Contributor

👋 I work for WP Tasty and we're thinking about using this library in our plugin, Tasty Recipes.

Have you considered offering imperial -> metric conversions (and back again)? Would you be open to some pull requests for this?

@cgatno
Copy link
Owner

cgatno commented Feb 4, 2019

Hey Daniel, great to meet you! That would be awesome; I'm definitely open to directing some more time and energy to maintaining this project if it were to be distributed in a scenario like that. (In fact, I'll go in and update the dev dependencies now to get rid of GitHub's security warnings.)

I think imperial <-> metric conversions would be a great addition that would fit well with the existing API. Would you be willing to kick start the work for that? I'd be more than happy to look over some PRs for that feature.

Thanks!

@danielbachhuber
Copy link
Contributor Author

That would be awesome; I'm definitely open to directing some more time and energy to maintaining this project if it were to be distributed in a scenario like that.

Sweet :)

(In fact, I'll go in and update the dev dependencies now to get rid of GitHub's security warnings.)

Thanks!

I think imperial <-> metric conversions would be a great addition that would fit well with the existing API. Would you be willing to kick start the work for that? I'd be more than happy to look over some PRs for that feature.

Yep, more than happy to. We're not moving on it immediately, so I'll loop back around when we plan to start.

@danielbachhuber
Copy link
Contributor Author

To share a bit more context, this is from our internal Asana:

This one is rather complicated. I think what people want is something like "1 cup flour => 128 g flour." The problem with this is that different ingredients have such different weights that without a library that contains nearly every ingredient amount it's pretty much impossible.

We need to do a bit more user research before we know which direction to head on this.

@cgatno
Copy link
Owner

cgatno commented Feb 9, 2019

@danielbachhuber thanks for the additional info, that definitely sheds some light on the issue. It sounds like you're looking to convert between volume (e.g. cups) and mass (e.g. grams).

I've run into this issue quite a bit when brewing coffee, for example. The most precise brewing instructions specify a coffee amount in grams, but most people are more familiar with using tablespoons to measure out coffee. It's impossible to directly interconvert between the two, because it depends on the density of that particular coffee.

Anyway, I think this can be split up into two separate issues:

  1. Conversion between imperial and metric units of the same physical property. This means volume <-> volume and mass <-> mass, for example. This would mean adding methods like toMilliliters() to the library.
  2. Conversion between physical properties for common cooking ingredients. This would allow for volume <-> mass conversions. This is the tougher problem, but I think it could be addressed by creating a table of densities for common items like flour, coffee, sugar, etc.

By being smart about the densities stored, I think the second item can be accomplished without adding much weight to the library at all.

@danielbachhuber
Copy link
Contributor Author

Cool :) We'll follow up when we dive into this project. Thanks!

@marcus-hiles
Copy link

Great tool @cgatno, keep the good work 👍 .
Lets connect and do great stuffs https://marcus-hiles.com/

@codingedgar
Copy link

  1. Conversion between imperial and metric units of the same physical property. This means volume <-> volume and mass <-> mass, for example. This would mean adding methods like toMilliliters() to the library.
  2. Conversion between physical properties for common cooking ingredients. This would allow for volume <-> mass conversions. This is the tougher problem, but I think it could be addressed by creating a table of densities for common items like flour, coffee, sugar, etc.

Hi! great library, I think both of this use cases present themself frequently with recipes.

For the second point maybe a complement like Moment timezone, could store all the transformations density of common ingredient, and some way to add explicit densities would be great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants