mirror of
https://github.com/placeAtlas/atlas.git
synced 2024-12-29 09:04:37 +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]
|
||||
}
|
||||
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]
|
||||
} else if (codeReference[periodString]) {
|
||||
variation = codeReference[periodString]
|
||||
|
@ -287,6 +287,7 @@ function formatPeriod(start, end, variation) {
|
|||
}
|
||||
else periodString = start
|
||||
}
|
||||
if (end > start) [start, end] = [end, start]
|
||||
else periodString = start + "-" + end
|
||||
if (periodString && variationString) return variationsConfig[variation].code + ":" + periodString
|
||||
if (variationString) return variationString
|
||||
|
|
Loading…
Reference in a new issue