Closed MoritzRitter closed 1 month ago
Hi @MoritzRitter Thank you for helping finding these issues and bugs. really appreciate it
this should be an issue in the toml parser library we are using. I have to debug it and see exactly whats the cause of this issue. I will inform asap
The issue arises because the toml package on npm is no longer maintained and only supports TOML specification version 0.4.0, which is outdated. I will try to find an alternative library and replace it.
Hi @MoritzRitter,
I've replaced the TOML library with smol-toml
, which supports TOML v1.0.0. Additionally, I've implemented a Date
field type, allowing the TOML string to be rendered as a date input.
You can check it out here:
https://guifier.com/toml/
It now successfully parses the toml date values.
Thanks for the update! There seems to be still be a little flaw:
When I open the page, everything is fine:
But then, when I edit the date using the widget, the date is written back as string (instead of a local date):
Expected: the local date date = 1979-05-28
(without the string quotes ""
).
I will check that asap
Currently, when editing the date, it gets parsed into this format:
The smol-toml library includes the time by default when handling dates. Based on their documentation, I couldn’t find a way to adjust the parsing behavior to output this specific date format:
Does this work for you?
Thanks for checking! Let's put it like this: I would need a local date without timezone info etc. And this is not what we have at the moment. But I can work around it. Much better than a parsing error!
Got it! Since this is related to the smol-toml library, I’ve opened an issue in their repository. Hopefully, they already have this feature or are willing to implement it.
Hi @MoritzRitter I fixed the issue now it works as expected even if the date is edited from the UI
Hi @maliknajjar Thanks for the update. There seems to be a new problem with the preservation of multi-line basic strings (acc. to https://toml.io/en/v1.0.0#string): When I add such a string like in this example: then it is already now displayed in the widget omitting the new lines. And when I then edit the date (or any other object) using the widgets on the right, then the string is converted to a basic string: While the content is probably still the same, this seems not to be the behavior that the user wants. Would you agree?
Hi @MoritzRitter, I created a seperate issue for this https://github.com/maliknajjar/guifier/issues/7 you can follow it there
Acc. to https://toml.io/en/v1.0.0#local-date a local date looks like this:
ld1 = 1979-05-27
However, the TOML Viewer & Editor at https://guifier.com/toml reports an error
Error: SyntaxError: Expected "T" but "\n" found.
Expected behavior: the local date is shown and can be edited.