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

Add time trimmer helpers #3

Open
cupakromer opened this issue Jun 20, 2013 · 0 comments
Open

Add time trimmer helpers #3

cupakromer opened this issue Jun 20, 2013 · 0 comments

Comments

@cupakromer
Copy link
Member

Using some of these in other projects. Would be nice to have them added. Not to keen on the naming just yet, so throwing some examples below:

time = Time.now
# => 2013-06-20 14:12:30 -0400
# => time.usec => 124634

time_truncate(time, :day)
# => 2013-06-20 14:12:30 -0400

time_truncate(time, :hour)
# => 2013-06-20 14:00:00 -0400

time_strip(time, :minute)
# => 2013-06-20 14:12:00 -0400

time_trim(time, :second)
# => 2013-06-20 14:12:00 -0400
# => time.usec => 0

See rspec/rspec-mocks#318 for a similar discussion.

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

No branches or pull requests

1 participant