zieiony / naturaldateformat Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
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?
Can get result as Facebook ,ex. just now , and automatically parse time not to combine relative and absolute and make algorithm to combine them...
like time in chatting i mean
And thanks very much for a nice library
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.
i will provide you Arabic translation string.xml file soon
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.