vorlif/spreak

data and time

Opened this issue · 4 comments

gedw99 commented

Describe the solution you'd like

https://github.com/golang-module/carbon could be used to give all aspects the ability to convert datas and times.

SO then we can incorporate this. It's needed in GUI and when you translate time between a DB and a GUI and back again. DB always should store dates as UTC, but GUI should show in dates adjusted to their own time zone.

vorlif commented

Hi @gedw99

There is no plan to add carbon or something like this. I want to keep the dependencies as small as possible. Also, since Django translations are currently used, more languages are supported.

You should keep a machine-readable format in the database, yes. But I don't understand the association with the libraries?
If you prefer to use carbon, that shouldn't be a problem.

gedw99 commented

I agree that fat dependencies are a bad idea.

I think we can write our own pretty easily if your up for it.

You said you did not understand the need ? Well say you have a sentence that has numbers or date time in it. You want to show it in the Users own locale of how they represent date time.

But you also need to convert that date time to their dat time zone too. Typically date time is always stored as UTC time in any medium ( db, etc ) and converted on the fly to the users own data time zone.

so thats just 2 primary examples that combine into 1.

vorlif commented

I understand that time must be kept in a machine-readable format during machine processing. (e.g. databases). However, I don't quite understand what role spreak or carbon play here. Spreak can convert a time into a human-readable format in different languages. Carbon does the same, in addition, it offers a lot of functions for editing time and timezones. There is no necessary connection between time zone and language.

Can you perhaps give a brief example of what should or should not work?

gedw99 commented

yeah I think your right about not needing carbon.

The use case is that you have a string that has date time in it and we need to convert that date time into the the users locale. So for German versus English the structure of how Date time is presented as a string is very different. Hope fully that is a concise enough example use case ?

I think I need to play with the code and see what it can handle with data time aspects.