mirror of
https://github.com/placeAtlas/atlas.git
synced 2024-12-29 09:04:37 +01:00
Fix period generation
This commit is contained in:
parent
55bc870531
commit
8728ca1d1b
2 changed files with 8 additions and 4 deletions
|
@ -43,7 +43,7 @@ function createInfoBlock(entry, isPreview) {
|
|||
else {
|
||||
let targetPeriod = formatPeriod(currentPeriod, currentPeriod, currentVariation)
|
||||
linkElement.href = "#" + entry.id
|
||||
if (targetPeriod) linkElement.href += "/" + targetPeriod
|
||||
if (targetPeriod && targetPeriod != defaultPeriod) linkElement.href += "/" + targetPeriod
|
||||
};
|
||||
const linkNameElement = document.createElement("span");
|
||||
linkNameElement.className = "flex-grow-1 text-break";
|
||||
|
|
|
@ -263,12 +263,16 @@ function parsePeriod(periodString) {
|
|||
}
|
||||
|
||||
function formatPeriod(start, end, variation) {
|
||||
let periodString
|
||||
let periodString, variationString
|
||||
variationString = variationsConfig[variation].code
|
||||
if (start === end) {
|
||||
if (start === variationsConfig[variation].default) periodString = ""
|
||||
if (start === variationsConfig[variation].default && variation !== defaultVariation) {
|
||||
periodString = ""
|
||||
}
|
||||
else periodString = start
|
||||
}
|
||||
else periodString = start + "-" + end
|
||||
if (variation !== "default") return variationsConfig[variation].code + ":" + periodString
|
||||
if (periodString && variationString) return variationsConfig[variation].code + ":" + periodString
|
||||
if (variationString) return variationString
|
||||
return periodString
|
||||
}
|
Loading…
Reference in a new issue