-
Notifications
You must be signed in to change notification settings - Fork 7.1k
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
calendar() displays wrong relative date #1411
Comments
I guess the interpretation of this / next / last differs from culture to culture. In USA, saying |
Stating 'this' or 'last' in this context is incorrect, IMO, because it introduces some ambiguity which is only clarified by using the verb in the right tense (future or past). I don't know if I'm wrong about how it goes in the USA, but in Russian saying 'прошлый вторник' (last tuesday) will almost always mean tuesday on the last week (unless future tense is used which, in turn, requires additional declination). Maybe saying 'вторник на этой неделе' (literally, 'this week's tuesday') is the correct form in this case? |
Also, it largely depends on the context — whether the user somehow expects that the date is always in the past (e.g. by looking at the event log) or in the future (e.g. by looking at the todo list). In both examples saying 'this tuesday' would mean different tuesdays :) |
@inca, I've been thinking about it for a long time. Actually, "В прошлый вторник" (last Tuesday) is correct only in several cases. Let's take a month where the First is Monday. So it's correct only if today is any day between Friday the 5th and Thursday the 11th, and you're referring to Tuesday the 2nd. So probably to patch this we need somehow to take the current day and make a |
I had given this one another thought, now I'm sure that the correct phrase totally depends on the context — whether the past or future (present simple) tense is used in conjunction with the date. With this in mind I came to a conclusion: when referring to the nearest week day — regardless of whether it is in the past or in the future — it is correct to say Some examplesLet's assume that today is Wednesday the 11th. Future contextLet's say you are watching the TV program guide or whether forecast (or anything else, but you expect all relative dates to point in present or future). Here's how you expect the dates to be displayed:
Past contextNow let's assume you are watching the event log (or some other context that will never contain dates from the future). Here's how you expect the dates in this case:
Few more notes
|
Sorry others, but... |
@Oire Спасибо за ответ, Андрей! Моим ожиданиям, скорее, не соответствуют фразы Приведу фрагмент приложения: Здесь датам, которые отмечены на календаре цветом, соответствуют записи в журнале. Даты в журнале, которые выводятся с помощью P.S. Я знаю, что предлагаемое мной решение — это слишком серьезное ограничение (потенциально сломается у пользователей, которые используют P.P.S. Sorry for the Russian, guys :) |
@inca, well, let's pass back to English to be understood by the others :). |
@Oire Since the As for the |
OK, I skimmed through the discussion, and I have to agree talking about weekdays is a complicated topic, and expecting future or past can play a role. If that is the case for most languages we can add this to moment. |
Yeap, the biggest source of confusion is what the reference is. If the reference is _this week, we have a context-free distribution. If the reference is _today, we have past or future distributions.
|
About my findings on CLDR, it has data for three relative values: {-1, 0, 1}. For example:
I have found no explicit documentation on how to use these values (the closest I found was this). |
My personal findings is that this whole story of _Reference: today-future (the TODO list example)_ Given a TODO list with "Next Wednesday, go to the gym". What day do you expect to go to the gym? Next week's Wed or After-next-week's Wed? Note today is "Thu" as in the above table. It's confusing, because we'd name it differently depending of the references. Although, if we had "Next Friday, go to the gym". It's clear we're talking about the next week's Fri. Both references would refer the same way to it. If the TODO list had lots of entries, and we could navigate through all the days until we see next Wed, it would also be clear. _Reference: today-past (the events log example)_ If we had an event "Last Fri, machine rebooted". What day do you expect your machine rebooted? Last week's Fri or before-next-week's Fri? It's the analogous case as what I wrote above. _Reference: this = this week (context-free use case)_ So, is this the salvation? Nope. There's one confusing case in here too: "This Sunday". Does it refer to the coming sunday or this week's sunday? The first day of the week (depending on your region's calendar) sounds confusing at least to me. _Conclusion_ It highly depends on your use case. Confusion could be avoided by avoiding to use it. For example, see github's comments. Each comment has a date. For dates within the [-7,-1] day range, it's shown as day of the week. For everything else, it's shown as a full date. They avoid using "last ...". So, there's no confusion. |
@rxaviers Great review, thank you! Frankly, I have already gave up using |
OK, so I'm closing this for now. If anybody wants to implement future/past aware calendar feel free to reopen it. |
Using moment 1.7.2 with languages. The unix time 1389172279000 is
Wed Jan 08 2014 09:11:19
. Today isFri Jan 10 2014 05:54:54
.When supplied to
moment.calendar(1389172279000);
the output is:last Wednesday at 5:11 PM
in local GMT +9 time in English.지난주 수요일 오후 5시 11분
same GMT +9 but in Korean.지난주
means last week, not this week, which in the current context is not correct. It should be this week's Wednesday.Even in English
last
refers to last week. I doubted this so checked your source code which has the follow code:Korean localization has a similar code:
The code clearly points that the word
last
meanslastWeek
. Thus Wednesday 08, two days ago from today's Friday is definitely not last week.The text was updated successfully, but these errors were encountered: