test timestamp
This commit is contained in:
48
wwws/admin/src/testtimestamp.html
Normal file
48
wwws/admin/src/testtimestamp.html
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Test Timestamp</title>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/dayjs@1/dayjs.min.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Test Timestamp avec Day.js</h1>
|
||||||
|
<pre id="output"></pre>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
(function(){
|
||||||
|
const output = document.getElementById("output");
|
||||||
|
|
||||||
|
function log(...args) {
|
||||||
|
console.log(...args);
|
||||||
|
output.textContent += args.join(" ") + "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Timestamp avec dayjs
|
||||||
|
const tsNow = dayjs().valueOf();
|
||||||
|
log("Timestamp dayjs().valueOf():", tsNow);
|
||||||
|
|
||||||
|
// Timestamp Date.now()
|
||||||
|
const tsSystem = Date.now();
|
||||||
|
log("Timestamp Date.now():", tsSystem);
|
||||||
|
|
||||||
|
// Différence
|
||||||
|
log("Différence (ms) :", tsNow - tsSystem);
|
||||||
|
|
||||||
|
// Conversion en date
|
||||||
|
log("Date locale :", new Date(tsNow).toString());
|
||||||
|
log("Date UTC :", new Date(tsNow).toUTCString());
|
||||||
|
|
||||||
|
// Vérification simple
|
||||||
|
if (tsNow - tsSystem > 5000 || tsNow - tsSystem < -5000) {
|
||||||
|
log("⚠️ Attention : décalage > 5s entre dayjs() et Date.now()");
|
||||||
|
} else {
|
||||||
|
log("✔ Timestamp cohérent");
|
||||||
|
}
|
||||||
|
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
|
Reference in New Issue
Block a user