wip migration
This commit is contained in:
29
utils/dataProcessing.js
Normal file
29
utils/dataProcessing.js
Normal file
@@ -0,0 +1,29 @@
|
||||
const dataProcessing = {
|
||||
isValidUrl(url) {
|
||||
if (url) return /^(ftp|http|https):\/\/[^ "]+\.+[^ "]+$/.test(url)
|
||||
else return true
|
||||
},
|
||||
|
||||
formatDatetime(date) {
|
||||
let d = new Date(date)
|
||||
let month = '' + (d.getMonth() + 1)
|
||||
let day = '' + d.getDate()
|
||||
let year = d.getFullYear()
|
||||
|
||||
if (month.length < 2) month = '0' + month
|
||||
if (day.length < 2) day = '0' + day
|
||||
|
||||
let formattedDate = [day, month, year].join('/')
|
||||
|
||||
let hour = d.getHours()
|
||||
let minutes = d.getMinutes()
|
||||
|
||||
let formattedTime = [hour, minutes].join(':')
|
||||
|
||||
let formattedDatetime = [formattedDate, formattedTime].join(' ')
|
||||
|
||||
return formattedDatetime
|
||||
},
|
||||
}
|
||||
|
||||
export default dataProcessing
|
||||
Reference in New Issue
Block a user