mirror of
https://github.com/wukko/cobalt.git
synced 2024-11-15 12:50:01 +00:00
web/ChangelogEntry: consistent date formatting
This commit is contained in:
parent
0391ac7230
commit
0e60ea9582
1 changed files with 18 additions and 2 deletions
|
@ -1,15 +1,31 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export let version: string;
|
export let version: string;
|
||||||
export let title: string;
|
export let title: string;
|
||||||
export let date: string;
|
export let date: string | undefined;
|
||||||
export let banner: { file: string; alt: string } | undefined;
|
export let banner: { file: string; alt: string } | undefined;
|
||||||
|
|
||||||
|
const formatDate = (dateString: string) => {
|
||||||
|
const date = new Date(dateString);
|
||||||
|
|
||||||
|
const months = ['January', 'February', 'March', 'April', 'May',
|
||||||
|
'June', 'July', 'August', 'September', 'October',
|
||||||
|
'November', 'December'];
|
||||||
|
|
||||||
|
return [
|
||||||
|
months[date.getUTCMonth()],
|
||||||
|
(date.getUTCDate() + 1) + ',',
|
||||||
|
date.getUTCFullYear()
|
||||||
|
].join(' ');
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
<div id="changelog-header">
|
<div id="changelog-header">
|
||||||
<div class="changelog-info">
|
<div class="changelog-info">
|
||||||
<div class="changelog-version">{version}</div>
|
<div class="changelog-version">{version}</div>
|
||||||
<div class="changelog-date">{date}</div>
|
{#if date}
|
||||||
|
<div class="changelog-date">{formatDate(date)}</div>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
<h1 class="changelog-title">{title}</h1>
|
<h1 class="changelog-title">{title}</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue