time.Time no longer automatically converted to Date
AntiPaste opened this issue · 3 comments
The README states that This is how now time.Time is managed in the library by default.
which was true as of commit c68aad5:
// manage time.Time automatically
result = result.ManageType(time.Time{}, "Date", "new Date(__VALUE__)")
However as of commit a7a821d this seems to be missing.
Can this functionality be restored or should the README be corrected?
Hm, just a moment, the README says:
converter := New()
converter.ManageType(time.Time{}, TypeOptions{TSType: "Date", TSTransform: "new Date(__VALUE__)"})
not:
result = result.ManageType(time.Time{}, "Date", "new Date(__VALUE__)")
Also, there is a test for this ManageType
in https://github.com/tkrajina/typescriptify-golang-structs/blob/master/typescriptify/typescriptify_test.go#L369
Am I missing something?
Sorry, let me rephrase.
Previously the library had code to handle time.Time
conversion to Javascript Date
automatically (see here). This meant that time.Time
was automatically converted to Javascript Date
when using the command-line tool tscriptify
or the library.
Somewhere in commit a7a821d this code was removed. (see here)
This means that when using the command-line tool tscriptify
or the library with default settings, time.Time
is no longer converted to Javascript Date
objects.
The README says:
This is how now time.Time is managed in the library by default.
Which is not the case, since that automatic conversion code has been removed.
Ah, yes, I see. You're right. I changed the README now, thanks!