mirror of
https://github.com/placeAtlas/atlas.git
synced 2025-01-01 03:34:25 +01:00
Swap if end > start
This commit is contained in:
parent
57a254fe8e
commit
06fc5d51df
1 changed files with 2 additions and 1 deletions
|
@ -266,7 +266,7 @@ function parsePeriod(periodString) {
|
||||||
periodString = split[1]
|
periodString = split[1]
|
||||||
}
|
}
|
||||||
if (periodString.search('-') + 1) {
|
if (periodString.search('-') + 1) {
|
||||||
let [start, end] = periodString.split('-').map(i => parseInt(i))
|
let [start, end] = periodString.split('-').map(i => parseInt(i)).sort()
|
||||||
return [start, end, variation]
|
return [start, end, variation]
|
||||||
} else if (codeReference[periodString]) {
|
} else if (codeReference[periodString]) {
|
||||||
variation = codeReference[periodString]
|
variation = codeReference[periodString]
|
||||||
|
@ -287,6 +287,7 @@ function formatPeriod(start, end, variation) {
|
||||||
}
|
}
|
||||||
else periodString = start
|
else periodString = start
|
||||||
}
|
}
|
||||||
|
if (end > start) [start, end] = [end, start]
|
||||||
else periodString = start + "-" + end
|
else periodString = start + "-" + end
|
||||||
if (periodString && variationString) return variationsConfig[variation].code + ":" + periodString
|
if (periodString && variationString) return variationsConfig[variation].code + ":" + periodString
|
||||||
if (variationString) return variationString
|
if (variationString) return variationString
|
||||||
|
|
Loading…
Reference in a new issue