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

Latte: added support for DateInterval in date helper #1359

Merged
merged 1 commit into from
Jan 20, 2014

Conversation

voda
Copy link
Contributor

@voda voda commented Jan 17, 2014

Is needed for TIME columns in MySQL after commit 36f3c33.

@xificurk
Copy link
Contributor

You need to use format method and actually respect the passed format argument

@dg
Copy link
Member

dg commented Jan 17, 2014

What about for example DateInterval('PT30H10M10S')?

@voda
Copy link
Contributor Author

voda commented Jan 17, 2014

Not sure, I don't like the DateInterval::format method, because it has another different syntax than currently supported DateTime::format and strftime. I use MySQL TIME column only for time of the day so this is good enough for me, but i can change it if anyone has a better proposal.

@voda
Copy link
Contributor Author

voda commented Jan 20, 2014

Changed it to DateInterval::format. Better now? If someone doesn't like the syntax, it is easy to make a custom helper.

@xificurk
Copy link
Contributor

As I look at it now, I think this should be separate helper ('time'?). It's not a good idea to mix DateInterval with DataTime, e.g. what would you expect to get from Helpers::date(new DateInterval('PT30H10M10S'))?

@voda
Copy link
Contributor Author

voda commented Jan 20, 2014

I don't think a separate helper is a good idea. What would be the difference between them? Maybe only in default format, but that could be implemented into the date helper as well.
I have no real use case for printing an interval like 'PT30H10M10S', only something like 30 hours ago.

dg added a commit that referenced this pull request Jan 20, 2014
Latte: added support for DateInterval in date helper
@dg dg merged commit cae6440 into nette:master Jan 20, 2014
@voda voda deleted the dateinterval branch January 20, 2014 12:03
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

Successfully merging this pull request may close these issues.

3 participants