Skip to content
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

Explicit API for local strptime #44

Open
Grinnz opened this issue Jun 7, 2019 · 4 comments
Open

Explicit API for local strptime #44

Grinnz opened this issue Jun 7, 2019 · 4 comments

Comments

@Grinnz
Copy link
Contributor

Grinnz commented Jun 7, 2019

Currently, to interpret a date string as localtime in strptime, you can get it to set islocal by calling it from an already local Time::Piece object:

my $time = localtime->strptime($date, $format);

It would be better if there was an explicit (and tested) way to do this, such as a third argument to strptime.

my $time = Time::Piece->strptime($date, $format, $local);
@szr8
Copy link

szr8 commented Feb 5, 2020

Would $local be the time zone that ->strptime interprets $date as, and if so, if the time zone is in $date, which one should win? Or would $local just set the time zone in new object?

@Grinnz
Copy link
Contributor Author

Grinnz commented Feb 5, 2020

$local would just be a boolean. Time::Piece objects can only be localtime or UTC.

@smith153
Copy link
Collaborator

smith153 commented Feb 5, 2020

Certainly noted. I've found the same issue annoying as well.

@scottchiefbaker
Copy link

Just to add my $0.02...

I just ran in to this strptime() bug/issue and it was not obvious how to solve it. This would be a much welcomed addition to the library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants