New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request for support for ISO/other date formats #27

Open
RaoOfPhysics opened this Issue Sep 24, 2018 · 6 comments

Comments

Projects
None yet
4 participants
@RaoOfPhysics

RaoOfPhysics commented Sep 24, 2018

Thanks for the nice package! Would you be willing to consider support for dates presented in a format other than %B %d, %Y, as mentioned in #23?

Perhaps entering the date with the ISO format of YYYY-MM-DD and allowing the user to select how it appears would be a good way forwards?

Many thanks, once again!

@jjallaire

This comment has been minimized.

Show comment
Hide comment
@jjallaire

jjallaire Sep 24, 2018

Member

Yes, the tricky thing is that we'd need to try parsing the date a bunch of different ways. One further issue is that you really need to know in advance whether it's MM-DD or DD-MM (as otherwise you might transpose interpretation of days and months). As a result it's often better to require a specific format.

In terms of display output that's of course completely orthogonal so we could make that fix no matter what we do with input.

Member

jjallaire commented Sep 24, 2018

Yes, the tricky thing is that we'd need to try parsing the date a bunch of different ways. One further issue is that you really need to know in advance whether it's MM-DD or DD-MM (as otherwise you might transpose interpretation of days and months). As a result it's often better to require a specific format.

In terms of display output that's of course completely orthogonal so we could make that fix no matter what we do with input.

@RaoOfPhysics

This comment has been minimized.

Show comment
Hide comment
@RaoOfPhysics

RaoOfPhysics Sep 25, 2018

Thanks for the prompt reply, @jjallaire!

[…] As a result it's often better to require a specific format.

In terms of display output that's of course completely orthogonal so we could make that fix no matter what we do with input.

Indeed, I was proposing that the specific format be YYYY-MM-DD. :) Perhaps the second option under date could allow the user to display it in the format of their choice. :)

I'm sure this will be some work for you, so please don't consider my request particularly high priority!

RaoOfPhysics commented Sep 25, 2018

Thanks for the prompt reply, @jjallaire!

[…] As a result it's often better to require a specific format.

In terms of display output that's of course completely orthogonal so we could make that fix no matter what we do with input.

Indeed, I was proposing that the specific format be YYYY-MM-DD. :) Perhaps the second option under date could allow the user to display it in the format of their choice. :)

I'm sure this will be some work for you, so please don't consider my request particularly high priority!

@jcolomb

This comment has been minimized.

Show comment
Hide comment
@jcolomb

jcolomb Oct 15, 2018

Hi,

I back up Rao on this, the format you ask for is not scientific, not inclusive (USA only), and it will bring interoperability problems (blogdown requires iso formated dates, for instance).

So if you can change it, please do !

jcolomb commented Oct 15, 2018

Hi,

I back up Rao on this, the format you ask for is not scientific, not inclusive (USA only), and it will bring interoperability problems (blogdown requires iso formated dates, for instance).

So if you can change it, please do !

@jjallaire

This comment has been minimized.

Show comment
Hide comment
@jjallaire

jjallaire Oct 16, 2018

Member

@yihui What date format(s) do you parse from the date field in blogdown?

It looks like we already support parsing dates in ymd format via lubridate::ymd: https://github.com/rstudio/radix/blob/master/R/utils.R#L54-L63

In terms of display of dates, that's actually currently handled by Distill (the framework that Radix is based upon) but we could try to override what they are doing.

Member

jjallaire commented Oct 16, 2018

@yihui What date format(s) do you parse from the date field in blogdown?

It looks like we already support parsing dates in ymd format via lubridate::ymd: https://github.com/rstudio/radix/blob/master/R/utils.R#L54-L63

In terms of display of dates, that's actually currently handled by Distill (the framework that Radix is based upon) but we could try to override what they are doing.

@yihui

This comment has been minimized.

Show comment
Hide comment
@yihui

yihui Oct 17, 2018

Member

blogdown doesn't parse the date; Hugo does. Hugo's documentation didn't seem to say what kind of date formats are accepted, but it seems to favor ISO (either 2017-01-07T00:00:00Z or 2017-01-07 is fine).

Given the endless pain with dealing with ambiguous date formats, personally I'd vote for ISO as the input format, too, and let users choose the display formats by themselves.

Member

yihui commented Oct 17, 2018

blogdown doesn't parse the date; Hugo does. Hugo's documentation didn't seem to say what kind of date formats are accepted, but it seems to favor ISO (either 2017-01-07T00:00:00Z or 2017-01-07 is fine).

Given the endless pain with dealing with ambiguous date formats, personally I'd vote for ISO as the input format, too, and let users choose the display formats by themselves.

@jjallaire

This comment has been minimized.

Show comment
Hide comment
@jjallaire

jjallaire Oct 18, 2018

Member

Okay, so as things currently stand we can parse ISO dates. However, date output is controlled by Distill and always of the form Jan. 7, 2017

Member

jjallaire commented Oct 18, 2018

Okay, so as things currently stand we can parse ISO dates. However, date output is controlled by Distill and always of the form Jan. 7, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment