1.0.3 • Published 5 months ago
local-iso-timestamp v1.0.3
local-iso-timestamp
A simple utility to get the current local date and time in ISO 8601 format with timezone offset.
Installation
npm install local-iso-timestamp
Usage
JavaScript
const { getLocalIsoTimestamp } = require('local-iso-timestamp');
console.log(getLocalIsoTimestamp());
// Output: 2024-10-12T22:15:16.521+13:00 (ISO 8601 format, depending on your local timezone)
const date = new Date('2023-10-12T22:15:16.521Z');
console.log(getLocalIsoTimestamp(date));
// Output: 2023-10-12T22:15:16.521+13:00 (ISO 8601 format, depending on your local timezone)
TypeScript
import { getLocalIsoTimestamp } from 'local-iso-timestamp';
console.log(getLocalIsoTimestamp());
// Output: 2024-10-12T22:15:16.521+13:00 (ISO 8601 format, depending on your local timezone)
const date = new Date('2023-10-12T22:15:16.521Z');
console.log(getLocalIsoTimestamp(date));
// Output: 2023-10-12T22:15:16.521+13:00 (ISO 8601 format, depending on your local timezone)