Commit b4f5e91a authored by Jonas Waeber's avatar Jonas Waeber
Browse files

Remove unused date helper object.

parent 10fcb6a6
/*
* mapper-service
* Copyright (C) 2020 Memoriav
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package org.memobase.helpers
object DateHelpers {
private val dateRangePatterns = listOf(
Regex("-|\u2013|\u2014")
)
private val dateSetPatterns = listOf(
Regex("/")
)
private val normalizedDatesPatterns = listOf(
Regex("[1-2][089][0-9][0-9]"),
Regex("[0-3][0-9]-[01][0-9]-[1-2][089][0-9][0-9]")
)
fun isNormalizedDate(value: String): Boolean {
normalizedDatesPatterns.forEach {
val result = it.matchEntire(value)
if (result != null) {
return true
}
}
return false
}
fun isDateRange(value: String): Boolean {
dateRangePatterns.forEach {
val result = it.find(value)
if (result != null) {
return true
}
}
return false
}
fun isDateSet(value: String): Boolean {
dateSetPatterns.forEach {
val result = it.find(value)
if (result != null) {
return true
}
}
return false
}
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment