
Research
Supply Chain Attack on Axios Pulls Malicious Dependency from npm
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.
@rangerrick/moment-javaformat
Advanced tools
This plugin for Moment.js adds support for formatting using the Java SimpleDateFormat and DateTimeFormatter format options.
It differs from moment-jdateformatparser in that it doesn't just try to translate Java format strings to Moment, but instead implements a new set of format methods that can handle a wider range of Java format strings, at the expense of speed.
Thanks to moment-jdateformatparser for the basic idea, I ran with it in my own way because we needed some formats that just plain aren't possible in a simple format string translation. :)
Changes made in the develop branch are checked against unit tests upon commit.
The latest CHANGELOG.md is then auto-generated from the commit history and merged to main.
This plugin requires loading either moment or moment-timezone, but some functionality will be undefined or fail if you are using Moment.js without timezone support.
In most cases, all you should have to do is load this module after you load moment, and then new methods are available to you for formatting:
const moment = require("moment-timezone");
require("@rangerrick/moment-javaformat");
let now = moment("2020-01-01T15:00:00Z");
// a format matching Java 8 SimpleDateFormat definitions
now.formatJavaSDF("yyyy-MM-dd HH:mm"); // 2020-01-01 15:00
// a format matching Java 8 DateTimeFormatter definitions
now.formatJavaDTF("yyyy-MM-dd HH:mm:ss O"); // 2020-01-01 15:00:00 GMT-05:00
You can install moment-javaformat from npm in the usual ways:
# install using npm
npm install --save @rangerrick/moment-javaformat
# install using yarn
yarn add @rangerrick/moment-javaformat
A few format strings are difficult to implement without going deeper down the rabbit hole than I was willing to go. ;)
W (week-of-month), F (day-of-week-in-month)W (week-of-month), F (day-of-week-in-month), n (nano-of-second), N (nano-of-day)I might implement the nano ones if I get around to doing the math (and probing window.performance.now()) but Date objects don't have that level of accuracy anyway.
moment-javaformat is freely distributable under the terms of the MIT license.
Copyright (c) 2020-2024 Benjamin Reed.
FAQs
Format Moment.js using Java format strings
The npm package @rangerrick/moment-javaformat receives a total of 511 weekly downloads. As such, @rangerrick/moment-javaformat popularity was classified as not popular.
We found that @rangerrick/moment-javaformat demonstrated a healthy version release cadence and project activity because the last version was released less than 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.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.

Security News
TeamPCP is partnering with ransomware group Vect to turn open source supply chain attacks on tools like Trivy and LiteLLM into large-scale ransomware operations.