Fuzzy date algorithm -


I'm looking for a fuzzy date algorithm. I'm just starting to write one and I realized that this is a tough job. To deal with special cases such as the difference between "yesterday", "last week" and "last last month", it got worn in a terrible code, whatever (in some cases) can mention the same day but personal Based on the date of the date is correct.

I think an open source should be a fuzzy date format, but I can not find it. Ideally, I want to use NSDT (OSX / IPhone) and its formatters but it is difficult to know if anybody has a fuzzy date format with regard to the duration of any time and returning a string ( But not limited to):

  • A few moments ago
  • This morning
  • yesterday
  • Last night
  • Last week
  • Last Wednesday
  • Beginning of last month
  • Last
  • A few years ago

In an ideal world I like it to be rich in the string as possible (i.e. "just a moment ago" like random Returning different forms like "now").

Explanation I'm looking a bit more subtle than the original buckets and stars. I have something that refers to both "tomorrow" and "last wednesday" for the same period but only one is right when today is Thursday.

There is a code in it that this site uses to calculate its relative time. You can not have specific categories in it, but once you get it set up, it's easy to add them.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -