emancu / toml-rb

A parser for TOML using Citrus library.
MIT License
104 stars 39 forks source link

Support for dumping DateTime and Dates #117

Closed ilikeorangutans closed 5 years ago

ilikeorangutans commented 5 years ago

The dumper currently only formats Time instances according to the TOML spec. However, some ruby programs use DateTimes or Dates which should also be formatted according to RFC3339.

DateTimes are formatted in the same way as Date instances. Dates are formatted yyyy-mm-dd without a timezone offset as ruby dates do not hold an offset

This PR adds require 'date' where needed. I'm not sure if this is acceptable in this project, but date is part of the rubylib and should be fine on any installation.

emancu commented 5 years ago

@ilikeorangutans Thanks for your PR. I'm out on vacations now, I will take a look as soon as possible. I need to review the other PR too, but this one will be easier for sure!

emancu commented 5 years ago

Also I need to review the latest version of TOML and specs.

ilikeorangutans commented 5 years ago

No worries; I have a hack in my project that works around, but this would much cleaner. Enjoy your vacation and let me know if you need help with any of this.

emancu commented 5 years ago

I didn't forget about this PR. I am working on the support for Toml 0.5 which is taking longer than expected.

I am still not sure if I want to introduce a dependency that could fire me back and make backwards compatibility harder on future implementations. However, I'm not discarding this either since toml-0.5 introduces some changes on date/timestamp types.

Hope to have updates soon!

emancu commented 5 years ago

@ilikeorangutans Great PR, I'm merging an releasing now!

ilikeorangutans commented 5 years ago

Horray! Thanks for merging! 🎉