Skip to content

Allow user to get/set the rounding method used when calculating relative time - #2848

Closed
numeraltwo wants to merge 1 commit into
moment:developfrom
numeraltwo:develop
Closed

numeraltwo wants to merge 1 commit into
moment:developfrom
numeraltwo:develop

Conversation

@numeraltwo

Copy link
Copy Markdown

There are many use cases where relative time humanization should use different rounding methods.

This PR is on the same wavelength as #1794

@maggiepint

Copy link
Copy Markdown
Member

My apologies that we haven't gotten around to this one until now.

I don't take any issue with the code changes, but I am wondering, why in your tests do you change the default values for relative time threshold? Is it just to make it easier to see what is going on with the rounding functions?

@klardotsh

Copy link
Copy Markdown

What needs to be done to get this merged? I'd be willing to adopt this one to do simple fixes in the name of getting it merged; this kind of thing would make my life a lot easier on a current project.

@maggiepint

Copy link
Copy Markdown
Member

@iv597 I'm going to mark this for release. For the most part, I was just making sure someone still wanted it before merging it to cut down on bulk in the code. If you want it, I think it can go. That said, if @ichernev doesn't like something about the implementation when he reviews it before final release, I would ask you to make what changes he would like,

@afilp

afilp commented May 31, 2016

Copy link
Copy Markdown

+1

@numeraltwo

Copy link
Copy Markdown
Author

Thanks all – I haven't been able to speak to this further because I have been super busy but I wanted to chime in as I realize my PR was a little terse. To clarify, my general use case for this was "pessimistic" countdowns (which you can see in the test cases). Not knowing Moment's internals super well the implementation feels a little bit patchy to me but the intent remains – there should be a simple way to change the core rounding function for humanization with another pure function.

@ichernev

Copy link
Copy Markdown
Contributor

Merged in c37aa84

@ichernev ichernev closed this Jun 14, 2016
ichernev added a commit that referenced this pull request Jun 14, 2016
Allow user to get/set the rounding method used when calculating relative time
@mattjohnsonpint mattjohnsonpint added this to the 2.14.0 milestone Jul 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants