morphir-elm icon indicating copy to clipboard operation
morphir-elm copied to clipboard

Add LocalTime support

Open stephengoldbaum opened this issue 3 years ago • 3 comments

Is your feature request related to a problem? Please describe. It's time... We need LocalTime in the SDK.

Describe the solution you'd like Support for basic time and time math. Keep it simple and local without time zones.

Describe alternatives you've considered None

Additional context We're going to need Timestamp soon...

stephengoldbaum avatar Oct 09 '21 17:10 stephengoldbaum

Hi @stephengoldbaum I would like to have a go at this issue. I need a little bit more information, is it the same idea behind the LocalDate in SDK?

Pancakem avatar Jan 26 '22 07:01 Pancakem

Hi @Pancakem , that is great to hear. Yes, it is essentially the same approach as LocalDate in that we need the structure, basic time math, and comparison. So it can totally be modeled after LocalDate. Implementing means three tasks:

  1. Define LocalTime in the Morphir.IR.SDK module - This defines LocalTime as a concept in the SDK of the IR. The SDK defines concepts that are to be implemented in the various backend target languages. So add LocalTime.elm into the src/Morphir/IR/SDK folder.
  2. Define how LocalTime will be handled in Elm - This is the implementation for Elm as a backend target language. This means finding the most appropriate Elm library for working with Time and mapping the SDK functions to use that. This is done by adding LocalTime to the Morphir.SDK module (src/Morphir/SDK/LocalTime.elm).
  3. Write tests - In the tests folder. LocalDate is a good example to follow.

That would be an excellent start. Once that's done we'll want to add the SDK implementation for Scala (in the morphir-jvm project), which you can optionally choose to do if you want.

Thank you and looking forward to your contribution!

stephengoldbaum avatar Jan 26 '22 18:01 stephengoldbaum

Sweet! On it.

Pancakem avatar Jan 27 '22 07:01 Pancakem