From 35ced9b9ad5e81a2fdb178415d848d4a9097e7da Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Thu, 18 Jul 2024 17:21:54 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20Hinzuf=C3=BCgen=20der=20detaillierten?= =?UTF-8?q?=20aktuellen=20Uhrzeit=20mit=20Zeitzoneninformation=20im=20Form?= =?UTF-8?q?at=20"dd.mm.yyyy,=20hh:mm:ss=20GMT+X".?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- EnvelopeGenerator.Web/wwwroot/js/annotation.js | 4 ++-- EnvelopeGenerator.Web/wwwroot/js/util.js | 18 +++++++++++------- EnvelopeGenerator.Web/wwwroot/js/util.min.js | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/EnvelopeGenerator.Web/wwwroot/js/annotation.js b/EnvelopeGenerator.Web/wwwroot/js/annotation.js index 6d3fbd9c..415277bb 100644 --- a/EnvelopeGenerator.Web/wwwroot/js/annotation.js +++ b/EnvelopeGenerator.Web/wwwroot/js/annotation.js @@ -62,7 +62,7 @@ backgroundColor: PSPDFKit.Color.DarkBlue, blendMode: 'multiply', boundingBox: new PSPDFKit.Geometry.Rect({ - width: width * 0.75, + width: width * 1.55, height: height / 2, top: top + height + 25 + date_place_top_shift, left: left + width * 1.30, @@ -77,7 +77,7 @@ const formFieldDate = new PSPDFKit.FormFields.TextFormField({ name: id_date, annotationIds: PSPDFKit.Immutable.List([annotation_date.id]), - value: locale_date_dd_mm_yyyy(), + value: detailedCurrentDate(), readOnly: true }) diff --git a/EnvelopeGenerator.Web/wwwroot/js/util.js b/EnvelopeGenerator.Web/wwwroot/js/util.js index 551bc841..07dd550a 100644 --- a/EnvelopeGenerator.Web/wwwroot/js/util.js +++ b/EnvelopeGenerator.Web/wwwroot/js/util.js @@ -46,13 +46,17 @@ async function getLocation() { } const getLocaleDateString = _ => new Date().toLocaleDateString('de-DE') - -function locale_date_dd_mm_yyyy() { - const today = new Date(); - const day = String(today.getDate()).padStart(2, '0'); - const month = String(today.getMonth() + 1).padStart(2, '0'); - const year = String(today.getFullYear()).slice(-4); - return `${day}/${month}/${year}`; + +function detailedCurrentDate() { + return new Intl.DateTimeFormat('de-DE', { + day: '2-digit', + month: '2-digit', + year: 'numeric', + hour: '2-digit', + minute: '2-digit', + second: '2-digit', + timeZoneName: 'shortOffset' + }).format(); } let __is_mobile = null; diff --git a/EnvelopeGenerator.Web/wwwroot/js/util.min.js b/EnvelopeGenerator.Web/wwwroot/js/util.min.js index 054ab348..1513340a 100644 --- a/EnvelopeGenerator.Web/wwwroot/js/util.min.js +++ b/EnvelopeGenerator.Web/wwwroot/js/util.min.js @@ -1 +1 @@ -function getCoordinates(){return new Promise((n,t)=>{navigator.geolocation?navigator.geolocation.getCurrentPosition(t=>n(t.coords),n=>t(n)):t(new Error("Geolocation is not supported by this browser."))})}async function getCity(){try{const t=await getCoordinates(),i=await fetch(`https://nominatim.openstreetmap.org/reverse?format=json&lat=${t.latitude}&lon=${t.longitude}`),n=await i.json();if(n&&n.address){const t=n.address.city||n.address.town||n.address.village||n.address.hamlet,i=n.address.postcode;return i+" "+t||""}}catch{return""}}async function getLocation(){try{const t=await getCoordinates(),i=await fetch(`https://nominatim.openstreetmap.org/reverse?format=json&lat=${t.latitude}&lon=${t.longitude}`),n=await i.json();if(n&&n.address){const t=n.address.city||n.address.town||n.address.village||n.address.hamlet,i=n.address.postcode;return{postalCode:i,city:t}}}catch{return{postalCode:"",city:""}}}function locale_date_dd_mm_yyyy(){const n=new Date,t=String(n.getDate()).padStart(2,"0"),i=String(n.getMonth()+1).padStart(2,"0"),r=String(n.getFullYear()).slice(-4);return`${t}/${i}/${r}`}function isMobile(){return __is_mobile===null&&(__is_mobile=/Mobi|Android/i.test(window.navigator.userAgent)),__is_mobile}const B64ToBuff=n=>new Uint8Array(Array.from(atob(n),n=>n.charCodeAt(0))).buffer;const getLocaleDateString=()=>(new Date).toLocaleDateString("de-DE");let __is_mobile=null; \ No newline at end of file +function getCoordinates(){return new Promise((n,t)=>{navigator.geolocation?navigator.geolocation.getCurrentPosition(t=>n(t.coords),n=>t(n)):t(new Error("Geolocation is not supported by this browser."))})}async function getCity(){try{const t=await getCoordinates(),i=await fetch(`https://nominatim.openstreetmap.org/reverse?format=json&lat=${t.latitude}&lon=${t.longitude}`),n=await i.json();if(n&&n.address){const t=n.address.city||n.address.town||n.address.village||n.address.hamlet,i=n.address.postcode;return i+" "+t||""}}catch{return""}}async function getLocation(){try{const t=await getCoordinates(),i=await fetch(`https://nominatim.openstreetmap.org/reverse?format=json&lat=${t.latitude}&lon=${t.longitude}`),n=await i.json();if(n&&n.address){const t=n.address.city||n.address.town||n.address.village||n.address.hamlet,i=n.address.postcode;return{postalCode:i,city:t}}}catch{return{postalCode:"",city:""}}}function detailedCurrentDate(){return new Intl.DateTimeFormat("de-DE",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:"shortOffset"}).format()}function isMobile(){return __is_mobile===null&&(__is_mobile=/Mobi|Android/i.test(window.navigator.userAgent)),__is_mobile}const B64ToBuff=n=>new Uint8Array(Array.from(atob(n),n=>n.charCodeAt(0))).buffer;const getLocaleDateString=()=>(new Date).toLocaleDateString("de-DE");let __is_mobile=null; \ No newline at end of file