mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
Fixe
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
|
||||
var month = [
|
||||
'Janeiro',
|
||||
'Fevereiro',
|
||||
'Março',
|
||||
'Abril',
|
||||
'Pode',
|
||||
'Junho',
|
||||
'Julho',
|
||||
'Agosto'
|
||||
]
|
||||
|
||||
var week = new Array('Domingo', 'Segunda', 'Terça', 'Quarta', 'Quinta', 'Sexta', 'Sábado');
|
||||
|
||||
class momentG {
|
||||
|
||||
static get(date){
|
||||
if(typeof date.getMonth != 'function') {
|
||||
console.log('not a function')
|
||||
date = new Date(date)
|
||||
}
|
||||
|
||||
var e = {
|
||||
day : week[date.getDay()],
|
||||
dd : ((date.getDate()).toString()).padStart("2","0"),
|
||||
mm : ((date.getMonth()+1).toString()).padStart("2","0"),
|
||||
MMMM : month[date.getMonth()],
|
||||
yyyy : date.getFullYear(),
|
||||
hour : date.getHours(),
|
||||
minu : ((date.getMinutes()).toString()).padStart("2","0"),
|
||||
}
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static run(date, formate , wgs){
|
||||
|
||||
if(typeof date.getMonth != 'function') {
|
||||
date = new Date(date)
|
||||
}
|
||||
|
||||
var e = {
|
||||
mm : ((date.getMinutes()).toString()).padStart("2","0"),
|
||||
dd : ((date.getDate()).toString()).padStart("2","0"),
|
||||
MM : ((date.getMonth()+1).toString()).padStart("2","0"),
|
||||
HH : date.getHours(),
|
||||
EEEE : week[date.getDay()].padStart("2","0"),
|
||||
MMMM : month[date.getMonth()],
|
||||
yyyy : date.getFullYear(),
|
||||
}
|
||||
|
||||
Object.keys(e).reverse().forEach(element => {
|
||||
var reg = new RegExp(element,'g')
|
||||
formate = formate.replace(reg,e[element])
|
||||
});
|
||||
|
||||
return formate
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
momentG: momentG.run
|
||||
};
|
||||
Reference in New Issue
Block a user