
Security News
rv Is a New Rust-Powered Ruby Version Manager Inspired by Python's uv
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
date-expand
Advanced tools
Expand a date into various representations of its constituent components, like 4-digit year, 2-digit year, month, two-digit month and so on. All strftime formats are included, and more. Use when you need serialized dates in logic-less templates.
Expand a date into all the various representations of its constituent components, like 4-digit year, 2-digit year, month, two-digit month and so on. All strftime formats are included, and more. Use when you need serialized dates in logic-less templates.
Install with npm install date-expand
.
Usage:
var expandDate = require('date-expand');
var date = new Date()
console.log(expandDate(date));
Or monkey-patch instead:
Object.defineProperty(Date.prototype, 'expand', {value: require('date-expand')});
var date = new Date()
console.log(date.expand());
Both will return an object containing various ways of representing that date:
{ human: 'Tue Sep 02 2014 11:10:51 GMT+0200 (CEST)',
datetime: '2014-09-02 09:10:51',
date: '2014-09-02',
time: '09:10:51',
clock: '09:10',
iso: '2014-09-02T09:10:51.299Z',
year: 2014,
month: 9,
day: 3,
hours: 11,
minutes: 10,
seconds: 51,
milliseconds: 299,
timestamp: 1409649051299,
unix: 1409649051,
offset: -120,
a: 'Tue',
A: 'Tuesday',
b: 'Sep',
B: 'September',
c: 'c',
C: '20',
d: '02',
D: '09/02/14',
e: ' 2',
F: '2014-09-02',
g: 'g',
G: 'G',
h: 'Sep',
H: '11',
I: '11',
j: '245',
m: '09',
M: '10',
n: '\n',
p: 'AM',
r: '11:10:51 AM',
R: '11:10',
S: '51',
t: '\t',
T: '11:10:51',
u: '2',
U: '35',
V: 'V',
w: '2',
W: '35',
x: 'x',
X: 'X',
y: '14',
Y: '2014',
z: '+0200',
Z: 'CEST' }
FAQs
Expand a date into various representations of its constituent components, like 4-digit year, 2-digit year, month, two-digit month and so on. All strftime formats are included, and more. Use when you need serialized dates in logic-less templates.
The npm package date-expand receives a total of 1 weekly downloads. As such, date-expand popularity was classified as not popular.
We found that date-expand demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.