Giter Site home page Giter Site logo

Idea on datetimes/timezones about pillar HOT 19 CLOSED

ijlyttle avatar ijlyttle commented on June 15, 2024
Idea on datetimes/timezones

from pillar.

Comments (19)

krlmlr avatar krlmlr commented on June 15, 2024 1

Happy to review a PR, but for now I'll focus on plugging the existing code into tibble.

from pillar.

hadley avatar hadley commented on June 15, 2024 1

Yeah exactly - and a separate function would be fine.

from pillar.

krlmlr avatar krlmlr commented on June 15, 2024 1

No worries, that's fine.

from pillar.

hadley avatar hadley commented on June 15, 2024

I don't know of a good (even approximate) way of generating the UTC offset. (Also need to remember that some time zones have partial hour offsets)

from pillar.

krlmlr avatar krlmlr commented on June 15, 2024

RcppCCTZ maybe?

from pillar.

ijlyttle avatar ijlyttle commented on June 15, 2024

Assuming RcppCCTZ meets the needs, I think the partial-hour problem could be overcome by using something like:

<dttm-03:30/-02:30>
2015-06-01 01:00:00

which would just fit.

I think the "range" of the offsets offered could be limited to the date-times being considered in the given column.

On the one hand, this would limit the printing of dual-offset headers to those cases where both offsets appear in the tibble. On the other hand, that would seem to make it harder to format consistently for normal and daylight-saving offsets.

from pillar.

hadley avatar hadley commented on June 15, 2024

And over long periods of time, I bet only two offsets is insufficient

from pillar.

ijlyttle avatar ijlyttle commented on June 15, 2024

If I'm reading the conversation correctly it sounds like this feature, though potentially useful, has edge cases that make things sufficiently difficult so as to outweigh the benefits.

I'll close the issue in the hopes that I will be able to do some twiddling myself.

If I come up with something worth talking about, I'll be happy to reopen and make a PR, even if only for the entertainment value ;)

If you (@hadley or @krlmlr) think this is worth keeping open, you'll not offend me by re-opening.

from pillar.

krlmlr avatar krlmlr commented on June 15, 2024

I think we could just add the time zone verbatim: Date-times use 19 characters anyway, most time zone descriptors (known to my system) are 14 characters or shorter:

quantile(nchar(OlsonNames()))
#>   0%  25%  50%  75% 100% 
#>    2   12   14   17   32

This means using <dt-...> as column type will display the time zone in full for half of the time zones, and it will be abbreviated automatically (and occupy only 19 spaces) if too wide. Thoughts?

from pillar.

hadley avatar hadley commented on June 15, 2024

Olson names are probably amenable to human shortening - split in two pieces, manually abbreviate first and then call abbreviate() on the second? (Use ... if there's three pieces?)

from pillar.

krlmlr avatar krlmlr commented on June 15, 2024

@ijlyttle: Would you like to take a stab?

from pillar.

ijlyttle avatar ijlyttle commented on June 15, 2024

@krlmlr: I would like to - first, let me look and see to make sure I can get my level-of-understanding where it needs to be to contribute.

from pillar.

ijlyttle avatar ijlyttle commented on June 15, 2024

I had a look, and I think I understand the idea - at its core, we would want a function that would take an Olson string, then return an abbreviated string of no more than 14 characters. Something like:

#' Abbreviate an Olson timezone to 14 characters
abbreviate_olson <- function(x) {

}

Then, you could take returned string and embed it into <dt-...>, which would be a maximum of 19 characters.

Alternatively, such a function could return all (max) 19 characters.

I don't know if you will want this in its own function or not, but it will give me a place to start.

Let me see what I can do here.

from pillar.

ijlyttle avatar ijlyttle commented on June 15, 2024

Just a heads-up that I don't think I can get to this until the end-of-the week (2017-09-16). I am eager to do it, but I don't want to be blocking things either.

from pillar.

randomgambit avatar randomgambit commented on June 15, 2024

hello there! I am just wondering, what about DST time changes? I mean, assume I print something between midnight and 5am on a DST day, the column header will be wrong, right? Can you possibly print some additional stuff? Like an asterisk or something that indicates this is a DST day?

from pillar.

ijlyttle avatar ijlyttle commented on June 15, 2024

As I understand it, the column header will refer to a time zone that is fixed to a geography, i.e. "America/New_York", which will not change if it is DST (or not).

How to address the significance of values for which DST is in effect would be a separate question, IMHO.

from pillar.

randomgambit avatar randomgambit commented on June 15, 2024

huuuum the more I think about it, the more printing the offset seems dead wrong.... The header will be likely to be wrong whenever the data encompasses a DST switch - which is very likely. Most useful in my opinion would be to have the Olson name (America-NY) abbreviated if needed.

from pillar.

krlmlr avatar krlmlr commented on June 15, 2024

Closing, should be possible to implement with the help of tidyverse/tibble#411 or a similar approach.

from pillar.

github-actions avatar github-actions commented on June 15, 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 pillar.

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.