@blossm/datetime
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -34,3 +34,3 @@ const timestampFromDate = require("./src/timestamp_from_date"); | ||
momentFromComponents, | ||
timestampFromComponents | ||
timestampFromComponents, | ||
}; |
{ | ||
"name": "@blossm/datetime", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Date and time functionality.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -1,2 +0,2 @@ | ||
module.exports = moment => { | ||
module.exports = (moment) => { | ||
const time = moment.second() + moment.minute() * 60 + moment.hour() * 3600; | ||
@@ -11,4 +11,4 @@ const day = moment.date(); | ||
month, | ||
year | ||
year, | ||
}; | ||
}; |
const momentFromTimestamp = require("./moment_from_timestamp"); | ||
const componentsFromMoment = require("./components_from_moment"); | ||
module.exports = timestamp => { | ||
module.exports = (timestamp) => { | ||
const moment = momentFromTimestamp(timestamp); | ||
return componentsFromMoment(moment); | ||
}; |
const Moment = require("moment"); | ||
module.exports = moment => Moment(moment); | ||
module.exports = (moment) => Moment(moment); |
@@ -1,1 +0,1 @@ | ||
module.exports = date => Math.floor(date.getTime()); | ||
module.exports = (date) => Math.floor(date.getTime()); |
const momentFromTimestamp = require("./moment_from_timestamp"); | ||
module.exports = timestamp => { | ||
module.exports = (timestamp) => { | ||
const moment = momentFromTimestamp(timestamp); | ||
return moment.format("MMMM Do YYYY, h:mm:ss a"); | ||
}; |
@@ -5,4 +5,4 @@ const { utc } = require("moment"); | ||
module.exports = timestamp => { | ||
module.exports = (timestamp) => { | ||
return utc(timestamp / millisecondsToSecondsRatio); | ||
}; |
@@ -1,1 +0,1 @@ | ||
module.exports = date => date.toISOString(); | ||
module.exports = (date) => date.toISOString(); |
const millisecondsToSecondsRatio = require("./_milliseconds_to_seconds_ratio"); | ||
module.exports = date => { | ||
module.exports = (date) => { | ||
return Math.floor(date.getTime() * millisecondsToSecondsRatio); | ||
}; |
const timestampFromDate = require("./timestamp_from_date"); | ||
module.exports = moment => { | ||
module.exports = (moment) => { | ||
return timestampFromDate(moment.toDate()); | ||
}; |
const momentFromTimestamp = require("./moment_from_timestamp"); | ||
module.exports = timestamp => { | ||
module.exports = (timestamp) => { | ||
const moment = momentFromTimestamp(timestamp); | ||
return moment.format("dddd, MMM Do"); | ||
}; |
@@ -15,3 +15,3 @@ const { expect } = require("chai"); | ||
month, | ||
year | ||
year, | ||
}; | ||
@@ -18,0 +18,0 @@ const moment = momentFromComponents(components); |
@@ -22,8 +22,4 @@ const { expect } = require("chai"); | ||
expect( | ||
moment() | ||
.utc() | ||
.valueOf() | ||
).to.equal(nowTimestamp); | ||
expect(moment().utc().valueOf()).to.equal(nowTimestamp); | ||
}); | ||
}); |
@@ -16,3 +16,3 @@ const { expect } = require("chai"); | ||
month, | ||
year | ||
year, | ||
}; | ||
@@ -19,0 +19,0 @@ |
12330
334