Code Monkey home page Code Monkey logo

Comments (9)

AshleyYakeley avatar AshleyYakeley commented on June 15, 2024

Could you be more specific about which type, etc.?

from time.

 avatar commented on June 15, 2024

TimeOfDay would be the first type. Currently todHour has a range of 0-23. If it represented a time of day the way ISO-8601 specifies, a TimeOfDay 24 0 0 would be valid and would represent midnight at the end of the day.

I don't know what kind of consequences this change would have for other types and functions. It's very possible that it would be more appropriate to have a separate ISO-8601 library. If you think that's the case, I can go my merry way. I would at least try to make such a library as similar to time and thyme as possible.

from time.

AshleyYakeley avatar AshleyYakeley commented on June 15, 2024

Right now you can construct "TimeOfDay 24 0 0", and you can construct a LocalTime with it, but "makeTimeOfDayValid 24 0 0" will give Nothing.

I'd need to know what operations you'd expect to behave how.

from time.

michelk avatar michelk commented on June 15, 2024

Currently

(parseTimeM True defaultTimeLocale "%d.%m.%Y %H:%M" "01.01.2021 24:00") :: Maybe UTCTime

evaluates to Nothing

But it should be equal to

(parseTimeM True defaultTimeLocale "%d.%m.%Y %H:%M" "02.01.2021 00:00")

from time.

AshleyYakeley avatar AshleyYakeley commented on June 15, 2024

Hmm, representing 24:00:00 might be a requirement for ISO 8601 formatting/parsing functions.

from time.

AshleyYakeley avatar AshleyYakeley commented on June 15, 2024

OK, I've fixed this for ISO 8601 formatting, where it's required.

from time.

AshleyYakeley avatar AshleyYakeley commented on June 15, 2024

Not sure what to do about parseTimeM etc.

from time.

AshleyYakeley avatar AshleyYakeley commented on June 15, 2024

So the options are:

  1. no change: if you want parsing to accept 24:00 then use the ISO 8601 functions
  2. parsing always accepts 24:00 (changing existing behaviour)
  3. a flag in TimeLocale that determines what to do

For 2 & 3, it's not clear what else should be allowed, e.g., Japanese 30-hour clock, or possibly even other fields out of range rolling over.

from time.

AshleyYakeley avatar AshleyYakeley commented on June 15, 2024

Going to stick with 1 for the time being.

from time.

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.