mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Fix Wiki Love Monuments year (#5049)
* Remove year from messages containing "Wiki Loves Monuments 2021" * Retrieve Wiki Love Monuments year dynamically * Add test and doc
This commit is contained in:
parent
33679eb6b4
commit
789960a966
15 changed files with 60 additions and 16 deletions
|
|
@ -18,6 +18,7 @@ import androidx.browser.customtabs.CustomTabsIntent;
|
|||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import fr.free.nrw.commons.kvstore.JsonKvStore;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import org.wikipedia.dataclient.WikiSite;
|
||||
import org.wikipedia.page.PageTitle;
|
||||
|
|
@ -243,4 +244,18 @@ public class Utils {
|
|||
return "30 Sep";
|
||||
}
|
||||
|
||||
/***
|
||||
* Function to get the current WLM year
|
||||
* It increments at the start of September in line with the other WLM functions
|
||||
* (No consideration of locales for now)
|
||||
* @param calendar
|
||||
* @return
|
||||
*/
|
||||
public static int getWikiLovesMonumentsYear(Calendar calendar) {
|
||||
int year = calendar.get(Calendar.YEAR);
|
||||
if (calendar.get(Calendar.MONTH) < Calendar.SEPTEMBER) {
|
||||
year -= 1;
|
||||
}
|
||||
return year;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue