This commit is contained in:
27
06_js-debug/uebungen/u05_error-format-date/index.html
Normal file
27
06_js-debug/uebungen/u05_error-format-date/index.html
Normal file
@@ -0,0 +1,27 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Übung 05: FormatDate Fehler</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet" />
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<div class="container py-5">
|
||||
<h1>Übung 05: FormatDate Fehler</h1>
|
||||
</div>
|
||||
</main>
|
||||
<script>
|
||||
'use strict';
|
||||
function formatDate(date) {
|
||||
const options = { year: 'numeric', month: 'long', day: 'numeric' };
|
||||
formatedDate = date.toLocaleDateString(undefined, options);
|
||||
return formattedDate;
|
||||
}
|
||||
|
||||
console.log(formatDate(new Date('2023-05-31'))); // => 'May 31, 2023'
|
||||
console.log(formatDate(new Date('2024-01-01'))); // => 'January 1, 2024'
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user