Giter VIP home page Giter VIP logo

Comments (10)

hadley avatar hadley commented on August 26, 2024

It might better to have a separate function for this which takes an explicit tz — this is useful when you have a vector of datetimes in UTC and a vector of local time zones and want to get the local time of day.

from hms.

krlmlr avatar krlmlr commented on August 26, 2024

I feel this is out of scope for this package. Isn't there an equivalent lubridate function?

from hms.

hadley avatar hadley commented on August 26, 2024

It feels like this is going to be a common way to create hms objects - it's often useful to partition a date-time into a date and a time. That feels very much in scope for hms (and I don't think there's an existing lubridate function for this)

from hms.

krlmlr avatar krlmlr commented on August 26, 2024

I have found x - lubridate::floor_date(x, "days"), and lubridate::with_tz(). Happy to implement lubridate::time_of_day() (which should return a Duration) and as.hms() methods in lubridate.

You described a common way to create time-of-day objects, but if you're dealing with timestamps, using lubridate seems a good idea anyway. I'd like to restrict the scope of hms, so unless there's a compelling reason to extend this package to handle dates, I'd prefer implementing ths in lubridate. Are we going to integrate lubridate in the tidyverse, or will there be a modern successor?

from hms.

krlmlr avatar krlmlr commented on August 26, 2024

as.hms.POSIXt() now has a tz argument, default UTC.

from hms.

hadley avatar hadley commented on August 26, 2024

It should default to the tz in x?

from hms.

krlmlr avatar krlmlr commented on August 26, 2024

Perhaps yes, but that would break compatibility. If this is important, I'd add a pkgconfig switch.

from hms.

hadley avatar hadley commented on August 26, 2024

I think it's probably fine to break compatibility given the number of uses, and the likelihood that anyone actually wants the local time in UTC.

from hms.

krlmlr avatar krlmlr commented on August 26, 2024

Agreed. The new default is now the local tz. I'd like to promote "pkgconfig" usage even if few will use it here.

from hms.

github-actions avatar github-actions commented on August 26, 2024

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.

from hms.

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.