Giter Site home page Giter Site logo

Comments (5)

adisarid avatar adisarid commented on May 28, 2024

Great initiative for doing this package. Important feature in format strings context: some languages/localization (e.g., Hebrew) specify date in %d/%m/%Y instead of the worldwide standard (%m/%d/%Y). When inputting a vector such as:
anytime(c("14/09/2016", "01/09/2016"))
You get an NA for the first value and an opposite day-month for the second value, though you can probably deduce the meaning from some values (in the example the first value) and apply it on "localization-ambiguous" values (in the example, the second).
Probably a unique situation (according to localization), so should be applied using a parameter.

from anytime.

eddelbuettel avatar eddelbuettel commented on May 28, 2024

Same with many European formats which do, say, %d.%m.%Y.

But this (famously) clashes with what North America does in its (braindead, but prevalent) %m/%d/%Y -- modulo the separators. There is no way to deal with the safely -- hence everybody's preference for ISO formats -- and strptime() et al have the same issue. I am not sure localization can help.

You can pre-load formats in the next version:

R> anytime:::addFormat("%d.%m.%Y") # Europe
R> anytime("10.11.2012")
[1] "2012-11-10 CST"
R> 

If you can work out how localization could help at the C++ level offered by Boost I'd be interested. Otherwise it is the "same old" issue also plagueing strptime() et al, and there is little I can do.

from anytime.

eddelbuettel avatar eddelbuettel commented on May 28, 2024

Good news: Boost has %x for locale-dependent input, see the docs.

I plan to test that.

from anytime.

eddelbuettel avatar eddelbuettel commented on May 28, 2024

Format strings can now be added.

from anytime.

adisarid avatar adisarid commented on May 28, 2024

Awesome, thanks!

from anytime.

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.