Skip to content

Commit

Permalink
fix: moved from luxon to moment, add timestamp.today method
Browse files Browse the repository at this point in the history
  • Loading branch information
jezhiggins committed Jun 18, 2018
1 parent 4df8702 commit 1284cd6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
11 changes: 9 additions & 2 deletions lib/plugin/components/services/timestamp/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
const DateTime = require('luxon').DateTime
const moment = require('moment')
const schema = require('./schema.json')

class TimestampService {
static get defaultProvider () {
return {
now () {
return DateTime.local()
return moment()
},
today () {
return moment().hour(0).minute(0).second(0).millisecond(0)
}
}
} // defaultProvider
Expand All @@ -18,6 +21,10 @@ class TimestampService {
now () {
return this.timeProvider.now()
}

today () {
return this.timeProvider.today()
}
} // class TimestampService

module.exports = {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"jsonschema": "1.2.4",
"lodash": "4.17.10",
"lru-cache": "4.1.3",
"luxon": "1.3.0",
"moment": "2.22.2",
"mkdirp": "0.5.1",
"mongodb-extended-json": "1.10.0",
"nanoid": "1.0.3",
Expand Down
4 changes: 2 additions & 2 deletions test/timestamp-state-resource-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
const path = require('path')
const expect = require('chai').expect
const tymly = require('../lib')
const DateTime = require('luxon').DateTime
const moment = require('moment')

const TestTimestamp = DateTime.local(2000, 2, 28, 22, 35, 0)
const TestTimestamp = moment([2000, 2, 28, 22, 35, 0]).local()
const TestTimestampString = `${TestTimestamp}`

const timestampStateMachine = 'tymlyTest_timestamp_1_0'
Expand Down

0 comments on commit 1284cd6

Please sign in to comment.