-
Notifications
You must be signed in to change notification settings - Fork 603
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 relative time formatting #389
Conversation
It formats offsets of a particular unit of time
Now returns words like today, yesterday, etc. if appropriate
@mbirtwell, thanks for your contribution. I will review your code soon. But, quick comments.
|
I've signed the CLA |
Ok I think I've got my head around most of the conversation in #205 what I propose doing is closing this pull request and creating two new ones. One for getDay because I think that's useful as it is. Although arguably could live in cldrjs. One for a relativeDuration function (the name is flexible), which will have the same API as my formatRelativeCount function which I think is very similar to the value + unit low level api that @ichernev is proposing. A full implementation could then be built on top of this. Unfortunately I want this api not the one that takes dates, so I'm not going to implement that. Let me know what you think? |
This method is very similar to |
About the relative time format function, on #205 we came up with an API that has Dates as parameters (which is summarized in the description of #205). You are suggesting it should take integer values. I think we can extend our original API (that takes Dates) to accept either a Date or an integer value. I suggest you to use our existing branch as a baseline and continue implementing from there. You could either close this PR and create a new one, or update this PR. I'm fine with either options. If you are interested, I can rebase our existing branch to the current master (in order to get that up-to-date first). How does that sound to you? |
I had a go at merging master in your fix-205 branch earlier and got that to I think there really is two functions here one that takes dates and on that On Thursday, 12 February 2015, Rafael Xavier de Souza <
|
Superseded by #395 |
Add `order` method to globalise.
Hi,
I wrote a couple of functions for formatting some date related things based on the cldr data.
getDay just looks up the names of days in the cldr data. (and supports the different formats that cldr supports)
formatRelativeCount formats an amount of time in a relative way. e.g. if you ask for 3 days in the past it will return 3 days ago. It tries to use words like today and tomorrow if available.