Giter Club home page Giter Club logo

naturaldateformat's People

Contributors

dkunzler avatar dvdmunckhof avatar louiscad avatar ndczz avatar quentin7b avatar victorraft avatar ydcool avatar zieiony avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

naturaldateformat's Issues

Question - Difference below 24 hrs, returns today in DAYS format

Hi there, I have a problem
I've start an event in 1477831898000 that ends in 1480078298000
Today time stamp is 1477901605205

I'm using RelativeDateFormat like this below:

RelativeDateFormat relativeDateFormat = new RelativeDateFormat(mContext, NaturalDateFormat.DAYS);

if (StartDate < 1000000000000L)  StartDate *= 1000;
if (EndDate < 1000000000000L) EndDate *= 1000;

eventStartDate.setText(relativeDateFormat.format(StartDate));
eventEndDate.setText(relativeDateFormat.format(EndDate));

In fact, event start day was yesterday! but library show this as Today!
You know what time difference between today and start time is under 24 hours but it started in yesterday!

Am I wrong?

Russian translation

Hello! I will be happy to add russian translation, but russian have some peculiarity (and probably some of other languages too).

We have different form of noun for numerals depends of number itself. For example:
1 hour ago - 1 час назад
2 hours ago - 2 часа назад
5 hours ago - 5 часов назад

in 1 minute - через 1 минуту
in 2 minutes - через 2 минуты
in 5 minutes - через 5 минут

so there should be array of strings

hours = {"час", "часа", "часов"}
minutes = {"минуту", "минуты", "минут"}

and real function for Russian will looks like:

int getIndexOfString(int number) {
  if (number % 10 == 1 && number % 100 != 11) {
    return 0;
  } else if (number % 10 >= 2 && number % 10 <= 4 && 
               (number % 100 < 10 || number % 100 >= 20)) {
    return 1;
  } else {
    return 2;
  }
}

looks quite strange, yep?) but its rules of language

for example for English we have the same logic but not so complex

hours = {"hour", "hours"}
minutes = {"minute", "minutes"}
int getIndexOfString(int number) {
  if (number == 1) {
    return 0;
  } else {
    return 1;
  }
}

Some kind of refactoring is required to implement it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.