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

[new-unit] can you impliment "AM/PM" and "24H" converter , also , can you directly map the enum with symbol through extension . #47

Open
talpx0 opened this issue May 26, 2024 · 2 comments

Comments

@talpx0
Copy link

talpx0 commented May 26, 2024

Description
Add here a brief explanation to which units should be added and possibly why (e.g. they are often used in a specific job). We know that there are a ton of unit of measurement that are not yet added to this app. We want to have just the most used one.

enum TEMPERATURE {
  fahrenheit,
  celsius,
  kelvin,
  reamur,
  romer,
  delisle,
  rankine,
}

extension TemperatureExtension on TEMPERATURE {
  String get symbol {
    switch (this) {
      case TEMPERATURE.fahrenheit:
        return '°F';
      case TEMPERATURE.celsius:
        return '°C';
      case TEMPERATURE.kelvin:
        return 'K';
      case TEMPERATURE.reamur:
        return '°Re';
      case TEMPERATURE.romer:
        return '°Rø';
      case TEMPERATURE.delisle:
        return '°De';
      case TEMPERATURE.rankine:
        return '°R';
      default:
        return '';
    }
  }
}

this can make code become much simple , you can directly do "Temperature. fahrenheit.symbol"
thanks , nice work

                |
@ferraridamiano
Copy link
Owner

Hello @talpx0

Angstrom and Pound are already part of the library, while we do not plan to support currencies (but you can easily do it, check the example in the README). For what concerns the extension on the enums, can be an intersting idea

@talpx0
Copy link
Author

talpx0 commented May 26, 2024

Hello @talpx0

Angstrom and Pound are already part of the library, while we do not plan to support currencies (but you can easily do it, check the example in the README). For what concerns the extension on the enums, can be an intersting idea

Hi , sorry , I added them mistakenly , what I want is AM/PM (12H) to (24H) , for example 8:00PM is 20:00 ? is that possible ? Yes , use enums on extension can make code much more simpler , you don't have to create class instance everytime you want to use the symbol . you can ask chatgpt to generate for you .

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

2 participants