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

Future date should use days #6

Open
uriva opened this issue Feb 19, 2017 · 9 comments
Open

Future date should use days #6

uriva opened this issue Feb 19, 2017 · 9 comments

Comments

@uriva
Copy link

uriva commented Feb 19, 2017

If the date is something in 5 days, I would expect to get a day of the week result, e.g. "friday, 10am" instead of "in 5 days".

@montanaflynn
Copy link
Owner

montanaflynn commented Feb 19, 2017

In that case why not use the prettyPrint method instead of relativeTime?

hdate.prettyPrint(new Date(1416448704578), { showTime: true })
// November 19th, 2014 at 5:58 pm

I could see adding in a dayName method which would return the day of the week so you could format such a string easily. It would be very similar to the monthName.

@uriva
Copy link
Author

uriva commented Feb 22, 2017

Cool.

As for the reason - because I do want it to say "tomorrow" when it is tomorrow and friday when friday is a couple of days away. Just as humans talk.

@montanaflynn
Copy link
Owner

There's times where it's appropriate to say "two months from now" rather than give a specific date so I don't think it should be a hard-coded rule in the library.

It should be easy to apply that logic outside of the library by checking how far out the date is and choosing the appropriate method or constructing your own string.

@uriva
Copy link
Author

uriva commented Feb 25, 2017

why close?
it's a valid feature request isn't it?

@montanaflynn
Copy link
Owner

The issue as it is currently is not something that I think makes sense for the library. I've suggested ways of how you could get the intended functionality and why I don't think it would make sense to change how the relativeTime method works.

The only thing that I would add would be a method for getting the date's human name such as "Friday" which isn't available with native date object similar to how human-date can return a month like "February". But that would be a separate issue I believe.

@uriva
Copy link
Author

uriva commented Feb 25, 2017

I think in general both in relative and absolute time, day names are important.
I think this library says "human-date" i.e. how humans talk. Humans don't say/understand "in 8 days", they say "Next Sunday".

Specifically I HAVE to use relativeTime, because I need to say stuff like "tomorrow" "in a couple of hours" "in 10 minutes" etc'. Right?

If we're not going to have that my only option is to write logic to see if it's this week, then just write the day name myself? Doesn't it sound cumbersome to you?

In what use case would a day-name in relativeTime be weird? Perhaps it should be a flag?

@uriva
Copy link
Author

uriva commented Feb 25, 2017

perhaps other contributors care to comment as well? If I'm the only one thinking this makes sense then of course I must be wrong :)
@nijikokun
@reda-ea
@gswalden

@nijikokun
Copy link
Contributor

nijikokun commented Feb 25, 2017

I agree with @montanaflynn's comments on your original issue request.

That said, this line specifically I can agree with; However, that was not your original request:

Humans don't say/understand "in 8 days", they say "Next Sunday".

@montanaflynn
Copy link
Owner

As I understood the original request it was after a certain period of days to replace it with the date. If it's to change it to "Next Sunday" or "This Friday" then I think that would make sense but where is the cutoff, and does it extend to weeks, months, etc...? ("In six months" vs "In August").

@uriva I'll reopen this issue, could you make a list of dates in the future and what you expect the library to output? That would be very helpful to understand what you're seeking and for implementation as well.

@montanaflynn montanaflynn reopened this Feb 27, 2017
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

3 participants