Añado archivos html, css, js para una primera prueba de funcionamiento de la app
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
|
||||
function mostrarFecha() {
|
||||
const hoy = new Date();
|
||||
|
||||
const opciones = {
|
||||
weekday: 'long',
|
||||
day: 'numeric',
|
||||
month: 'long',
|
||||
year: 'numeric'
|
||||
};
|
||||
|
||||
const fechaFormateada = hoy.toLocaleDateString('es-ES', opciones);
|
||||
|
||||
const divFecha = document.getElementById('fecha');
|
||||
if (divFecha) {
|
||||
divFecha.textContent = fechaFormateada;
|
||||
}
|
||||
}
|
||||
|
||||
function actualizarHora() {
|
||||
const ahora = new Date();
|
||||
|
||||
const horas = String(ahora.getHours()).padStart(2, '0');
|
||||
const minutos = String(ahora.getMinutes()).padStart(2, '0');
|
||||
const segundos = String(ahora.getSeconds()).padStart(2, '0');
|
||||
|
||||
const horaFormateada = `${horas}:${minutos}:${segundos}`;
|
||||
|
||||
const divHora = document.getElementById('hora');
|
||||
if (divHora) {
|
||||
divHora.textContent = horaFormateada;
|
||||
}
|
||||
}
|
||||
|
||||
mostrarFecha();
|
||||
actualizarHora();
|
||||
setInterval(actualizarHora, 1000);
|
||||
});
|
||||
Reference in New Issue
Block a user