File tree Expand file tree Collapse file tree
frontend/src/lib/components Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11<script >
22 let { date } = $props ();
33
4- let dates = [];
4+ function getDateString () {
5+ let dates = [];
56
6- for (const key of [' notBefore' , ' notAfter' ]) {
7- if (date[key]) {
8- if (date[key] < 0 ) {
9- dates .push (` ${ Math .abs (date[key])} BC` );
7+ for (const key of [' notBefore' , ' notAfter' ]) {
8+ if (date[key]) {
9+ if (date[key] < 0 ) {
10+ dates .push (` ${ Math .abs (date[key])} BC` );
11+ } else {
12+ dates .push (` AD ${ date[key]} ` );
13+ }
1014 } else {
11- dates .push (` AD ${ date[key] } ` );
15+ dates .push (' Unknown ' );
1216 }
13- } else {
14- dates .push (' Unknown' );
1517 }
18+
19+ return dates .join (' - ' );
1620 }
1721
18- let dateString = $derived (dates . join ( ' – ' ));
22+ let dateString = $derived (getDateString ( ));
1923 </script >
2024
2125<span class ="inscription-date" >{dateString }</span >
You can’t perform that action at this time.
0 commit comments