New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

date_utils

Package Overview
Dependencies
Maintainers
4
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

date_utils

Consists of date utility functions.

latest
Source
npmnpm
Version
1.4.0
Version published
Weekly downloads
5
-73.68%
Maintainers
4
Weekly downloads
 
Created
Source

date_utils

Consists of date utility functions.

Build Status Coverage Status Dependency Status

Continuous Integration

Currently using travis-ci.org for continuous integration.

Code Coverage

Currently using coveralls.io to provide code coverage badge.

This can be used on the server (nodejs) or the client

The client version of this file can be found at /dist/dateUtils.js To use this version window.__dateUtils

Nodejs Examples

const dateUtils = require('date_utils')

let d = dateUtils('2012-12-01')
d.dateProvided       -> '2012-12-01'
d.asUtc              -> Returns a UTC version of moment object
d.momentDate         -> Moment-ized date object for you to do with what you want
d.ticks              -> valueOf() in Moment
d.standardDateFormat -> '2012-12-01 00:00:00'
d.dateForDisplay     -> '2012-12-01'
d.dateForDisplayFull -> 'December 01, 2012'
d.toDbFormat         -> '2012-12-01T06:00:00.000Z' instance of Date

AddDuration

let d = dateUtils('2012-12-01')
// Acceptable formats +1d, +1m, +1w, +1y ....
d.addDuration() // Defaults to +0d
d.addDuration('+1d') -> same object as above

d.addDuration('+3d').format('YYYY-MM-DD') -> '2012-12-04'

General format method

let d = dateUtils('2012-12-01')
// There exists a general format method which just proxies moment's format
// More info: http://momentjs.com/docs/#/displaying/format/
d.format('YYYY ... MM ... DD') -> '2012 ... 12 ... 01'

#Client Examples

<script type="text/javascript" async src="/dist/dateUtils.js"></script>

var dateUtils = window.__dateUtils;

var d = dateUtils('2012-12-01')
d.dateProvided       -> '2012-12-01'
d.momentDate         -> Moment-ized date object for you to do with what you want
d.ticks              -> valueOf() in Moment
d.standardDateFormat -> '2012-12-01 00:00:00'
d.dateForDisplay     -> '2012-12-01'
d.dateForDisplayFull -> 'December 01, 2012'
d.toDbFormat         -> '2012-12-01T06:00:00.000Z' instance of Date

let d = dateUtils('2012-12-01')
// Acceptable formats +1d, +1m, +1w, +1y ....
d.addDuration() // Defaults to +0d
d.addDuration('+1d') -> same object as above

d.addDuration('+3d').format('YYYY-MM-DD') -> '2012-12-04'

Keywords

date

FAQs

Package last updated on 09 Jun 2017

Did you know?

Socket

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.

Install

Related posts