npmpackage2022
v1.0.0
Published
providing formated datetime
Downloads
1
Readme
npm install npmpackage2022
import
const npkage = require('npmpackage2022')
formate datetime
// invoke dateFormat to format date
const dtStr = npkage.dateFormat(new Date())
// result 2020-04-03 17:20:58
console.log(dtStr)
Escaping special characters in HTML
// HTML strings with conversions
const htmlStr = '<h1 title="abc">this is h1 tag<span>123 </span></h1>'
// Call the htmlEscape method for conversion
const str = dtStr.htmlEscape(htmlStr)
// result <h1 title="abc">this is h1 tag <span>123&nbsp;</span></h1>
console.log(str)
Restore special characters to HTML
// Restore special characters to HTML
const str2 = dtStr.htmlUnEscape(str)
// result <h1 title="abc">this is h1 tag<span>123 </span></h1>
console.log(str2)
Open Source Protocols
ISC