Every line of 'iso date format javascript' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
115 export function formatIso(date) { 116 return (new Date(`${date.toDateString()} 12:00:00 +0000`)).toISOString().substring(0, 10); 117 }
128 function formatISO(date?: Date) { 129 if (!date) { return undefined; } 130 131 return date.getUTCFullYear() + 132 '-' + pad(date.getUTCMonth() + 1) + 133 '-' + pad(date.getUTCDate()) + 134 'T' + pad(date.getUTCHours()) + 135 ':' + pad(date.getUTCMinutes()) + 136 ':' + pad(date.getUTCSeconds()); 137 138 function pad(num: number) { 139 if (num < 10) { 140 return '0' + num; 141 } 142 return num; 143 } 144 }
28 export function formatDateTimeStringISO(dateTimeString) { 29 if (!dateTimeString) { 30 return blankValue; 31 } 32 const parts = new Intl.DateTimeFormat('en', { 33 year: 'numeric', 34 month: '2-digit', 35 day: '2-digit', 36 hour: '2-digit', 37 minute: '2-digit', 38 second: '2-digit', 39 hour12: false, 40 }).formatToParts(new Date(dateTimeString)); 41 const keys = {}; 42 for (const {type, value} of parts) { 43 keys[type] = value; 44 } 45 return `${keys.year}-${keys.month}-${keys.day} ${keys.hour}:${keys.minute}:${keys.second}`; 46 }
9 function date (isostring) { 10 return isostring 11 }
35 function getDateTimeISO() { 36 var date = new Date(); 37 return date.toISOString(); 38 }
106 getISOTimestamp(date) { 107 return date.toISOString().split('.')[0] + 'Z'; 108 }
3 export function isoDate(date: Date): string{ 4 return date_format("isoDateTime") 5 }
39 function formatISODate(timestamp) { 40 return new Date(timestamp).toISOString() 41 .split("T") 42 .join(" ") 43 .split(".")[0]; 44 }
14 function toISO(date: string) { 15 return date ? new Date(date).toISOString().slice(0, -5) + 'Z' : null; 16 }
7 function ISODateString(d) 8 { 9 function pad(n){ return n < 10 ? '0' + n : n } 10 11 return d.getUTCFullYear()+'-' 12 + pad(d.getUTCMonth()+1)+'-' 13 + pad(d.getUTCDate())+'T' 14 + pad(d.getUTCHours())+':' 15 + pad(d.getUTCMinutes())+':' 16 + pad(d.getUTCSeconds())+'Z'; 17 }