viphe / SDL.rb

The Simple Declarative Language provides an easy way to describe lists, maps, and trees of typed data in a compact, easy to read representation. The simple and intuitive API allows you to read, write, and access all the datastructures using a single class. For property files, configuration files, logs, and simple serialization requirements, SDL provides a compelling alternative to XML and Properties files. Implementations are available for Java and .NET; a port to C++ is in the works, with more languages on the way.
https://rubygems.org/gems/sdl4r
Other
0 stars 0 forks source link

date fields beyond normal boundaries (e.g. negative hours) are not supported #1

Open viphe opened 11 years ago

viphe commented 11 years ago

The Java implementation (which relies on java.util.Calendar) allows unconventional dates like:

2013/2/22 -07:53 2010/2/22 30:65

The Ruby implementation chokes on it with an exception.

viphe commented 11 years ago

The SDL spec doesn't really say much about those cases, but it would be nice if the interoperability was possible.

viphe commented 11 years ago

Did a few tests and:

  1. In java.util.Calendar, each signs on fields work independently: -07:53 means -7 hours +53 minutes and not -7 hours -53 minutes.
  2. In java.util.Calendar, values beyond usual boundaries roll the bigger units (25h means +1d +1h).
  3. Ruby DateTime supports negative hours (down to -24) but it doesn't modify the bigger units (-1h means 23h and not -1d at 23h).