fix webtoon es parse date (#5447)
This commit is contained in:
		
							parent
							
								
									89e60709ef
								
							
						
					
					
						commit
						f4c4760c6f
					
				| @ -5,7 +5,7 @@ ext { | ||||
|     extName = 'Webtoons' | ||||
|     pkgNameSuffix = 'all.webtoons' | ||||
|     extClass = '.WebtoonsFactory' | ||||
|     extVersionCode = 24 | ||||
|     extVersionCode = 25 | ||||
|     libVersion = '1.2' | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -77,4 +77,17 @@ class WebtoonsChineseTraditional : WebtoonsDefault("zh", "zh-hant", "zh_TW", Sim | ||||
| 
 | ||||
| class WebtoonsFr : WebtoonsDefault("fr", dateFormat = SimpleDateFormat("d MMM yyyy", Locale.FRENCH)) | ||||
| 
 | ||||
| class WebtoonsEs : WebtoonsDefault("es", dateFormat = SimpleDateFormat("d-MMM-yyyy", Locale("es"))) | ||||
| class WebtoonsEs : WebtoonsDefault("es") { | ||||
|     // Android seems to be unable to parse es dates like Indonesian; we'll use a short hard-coded table | ||||
|     // instead. | ||||
|     private val dateMap: Array<String> = arrayOf( | ||||
|         "Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic" | ||||
|     ) | ||||
| 
 | ||||
|     override fun chapterParseDate(date: String): Long { | ||||
|         val expr = Regex("""(\d+)-([a-z]{3})-(\d{4})""").find(date) ?: return 0 | ||||
|         val (_, day, monthString, year) = expr.groupValues | ||||
|         val monthIndex = dateMap.indexOf(monthString) | ||||
|         return GregorianCalendar(year.toInt(), monthIndex, day.toInt()).time.time | ||||
|     } | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Riztard Lanthorn
						Riztard Lanthorn