Code Monkey home page Code Monkey logo

Comments (5)

epage avatar epage commented on August 27, 2024

Options

  • Revert the change
  • Add a feature flag for full date validation, which pulls in chrono
  • Do nothing (like toml-rs)

from toml.

ordian avatar ordian commented on August 27, 2024

Curious how other parsers handle that (e.g. in other languages). It seems toml spec specifies the date should follow the https://datatracker.ietf.org/doc/html/rfc3339. And if chrono panics on construction instead of returning an error, that's not good either, but I would lean towards Do nothing and documenting this behavior.

from toml.

epage avatar epage commented on August 27, 2024

Chrono offers panicing and Option variants of its constructors

Looking at the RFC, it seems like it shouldn't be too bad to address days of month. I assume the complexity in chrono is coming from other functionality.

Leap seconds is an interesting one. If you don't bother with a lookup table, it simplifies things but knowing whether you can have a leap second or not is dependent on the month. So a date-less time can't do validation and combining a date and time can error.

from toml.

epage avatar epage commented on August 27, 2024

As for other languages, toml-test validates that toml parsers reject months with 50 days but doesn't validate further. So parsers using that test (like go) at least validate that much.

Python's toml loads into datetime which handles leap years. I did not verify how it handles leap seconds

from toml.

parasyte avatar parasyte commented on August 27, 2024

If my preference is at all useful here, I would like chrono behind a feature flag if you intend to add it again.

The project where I use toml_edit already has a ton of dependencies. And while chonro is not large compared to everything else I depend on, I do try to keep the tree as thin as possible by removing unnecessary features. A feature flag would just be really nice to have.

from toml.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.