Socket
Socket
Sign inDemoInstall

@types/luxon

Package Overview
Dependencies
0
Maintainers
1
Versions
82
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @types/luxon

TypeScript definitions for luxon


Version published
Weekly downloads
2.5M
decreased by-18.88%
Maintainers
1
Install size
118 kB
Created
Weekly downloads
 

Package description

What is @types/luxon?

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.

What are @types/luxon's main functionalities?

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());

Other packages similar to @types/luxon

Readme

Source

Installation

npm install --save @types/luxon

Summary

This package contains type definitions for luxon (https://github.com/moment/luxon#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/luxon.

Additional Details

  • Last updated: Fri, 19 Jan 2024 22:06:57 GMT
  • Dependencies: none

Credits

These definitions were written by Carson Full, and Piotr Błażejewicz.

FAQs

Last updated on 19 Jan 2024

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc