Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
@types/luxon
Advanced tools
The @types/luxon package provides TypeScript type definitions for Luxon, a powerful library for dealing with dates and times in JavaScript. It allows developers to use Luxon in TypeScript projects with type checking, enabling better development experience and error handling. The main functionalities include parsing, validating, manipulating, and formatting dates and times.
Creating and formatting dates
This feature allows the creation of a DateTime object representing the current date and time, and then formats it into an ISO 8601 string.
import { DateTime } from 'luxon';
const now = DateTime.now();
console.log(now.toISO());
Parsing and manipulating dates
This demonstrates how to parse an ISO 8601 date string into a DateTime object, add 1 day and 2 hours to it, and then convert it back to a string.
import { DateTime } from 'luxon';
const dt = DateTime.fromISO('2023-04-01T10:20:30');
const newDt = dt.plus({ days: 1, hours: 2 });
console.log(newDt.toString());
Working with time zones
This shows how to create a DateTime object for the local time and then convert it to a specific time zone.
import { DateTime } from 'luxon';
const local = DateTime.local();
const zoned = local.setZone('Europe/Paris');
console.log(zoned.toString());
Moment.js is a legacy date manipulation library that offers a wide range of functionalities similar to Luxon, such as parsing, validation, manipulation, and formatting of dates. However, Luxon is considered a modern alternative with better support for internationalization and immutable data structures.
date-fns provides over 200 functions for date manipulation, parsing, and formatting. It is modular, allowing developers to include only the functions they need. Compared to Luxon, date-fns offers a more functional programming approach and is timezone agnostic.
Day.js is a lightweight date library that mimics Moment.js API but with a smaller footprint. It is extensible through plugins. While it offers similar functionalities as Luxon, its plugin-based architecture allows for more customization and potentially smaller bundle sizes in projects.
npm install --save @types/luxon
This package contains type definitions for luxon (https://github.com/moment/luxon#readme).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/luxon.
luxon
These definitions were written by Hyeonseok Yang, Jonathan Siebern, Matt R. Wilson, Pietro Vismara, Janeene Beeforth, Jason Yu, Aitor Pérez Rodal, Piotr Błażejewicz, Carson Full, Hugo Silva, and Martin Badin.
FAQs
TypeScript definitions for luxon
The npm package @types/luxon receives a total of 3,065,044 weekly downloads. As such, @types/luxon popularity was classified as popular.
We found that @types/luxon 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
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.