
Product
A Fresh Look for the Socket Dashboard
We’ve redesigned the Socket dashboard with simpler navigation, less visual clutter, and a cleaner UI that highlights what really matters.
convict-format-with-moment
Advanced tools
Formats duration
and timestamp
for convict with Moment.js.
npm install convict-format-with-moment
An example config.js
file:
const convict = require('convict');
const convict_format_with_moment = require('convict-format-with-moment');
// Add all formats
convict.addFormats(convict_format_with_moment);
// Or add only specific formats:
// convict.addFormat(convict_format_with_moment.duration);
// etc.
// Define a schema
var config = convict({
format: {
format: 'duration'
},
format: {
format: 'timestamp'
}
});
Validation done through Moment.js:
duration
- milliseconds or a human readable string (e.g. 3000, "5 days")timestamp
- Unix timestamps or date strings recognized by Moment.jsConvict will automatically coerce environmental variables from strings to their proper types when importing them. For instance, values with the format int
, nat
, port
, or Number
will become numbers after a straight forward parseInt
or parseFloat
. duration
and timestamp
are also parse and converted into numbers, though they utilize Moment.js for date parsing.
FAQs
Formats 'duration' and 'timestamp' for convict
The npm package convict-format-with-moment receives a total of 15,382 weekly downloads. As such, convict-format-with-moment popularity was classified as popular.
We found that convict-format-with-moment demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
We’ve redesigned the Socket dashboard with simpler navigation, less visual clutter, and a cleaner UI that highlights what really matters.
Industry Insights
Terry O’Daniel, Head of Security at Amplitude, shares insights on building high-impact security teams, aligning with engineering, and why AI gives defenders a fighting chance.
Security News
MCP spec updated with structured tool output, stronger OAuth 2.1 security, resource indicators, and protocol cleanups for safer, more reliable AI workflows.