Skip to content

Commit

Permalink
feat: provide format function on timestamp service (#659)
Browse files Browse the repository at this point in the history
  • Loading branch information
meenahoda committed Jun 3, 2024
1 parent 063080f commit f3a6fea
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/plugin/components/services/timestamp/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ class TimestampService {
today () {
return moment().hour(0).minute(0).second(0).millisecond(0)
},
getYear (dateInput = new Date()) {
getYear () {
return moment().format('yyyy')
},
format (value, format = 'YYYY-MM-DD HH:mm:ss') {
return moment(value).format(format)
}
}
} // defaultProvider
Expand All @@ -31,10 +34,14 @@ class TimestampService {
getYear () {
return this.timeProvider.getYear()
}

format (value, format) {
return this.timeProvider.format(value, format)
}
} // class TimestampService

module.exports = {
serviceClass: TimestampService,
schema: schema,
schema,
bootBefore: ['statebox']
}

0 comments on commit f3a6fea

Please sign in to comment.