Monatsberechnung javascript

This commit is contained in:
aschwarz 2024-02-05 14:11:54 +01:00
parent ac60d94932
commit ba7ae70fd2

21
test.html Normal file
View File

@ -0,0 +1,21 @@
<html>
<head>
<script src=" https://cdn.jsdelivr.net/npm/dayjs@1.11.10/dayjs.min.js "></script>
<script type="text/javascript">
function test(){
const date1 = dayjs('2024-04-14')
date3 = date1.add(1, 'day')
const date2 = dayjs('2024-01-15')
date3.diff(date2) // 20214000000 default milliseconds
alert(date3.diff(date2,'month',true));
}
</script>
</head>
<body>
<button onclick="test();">Click me</button>
</body>
</html>