@below43/local-iso-timestamp
v1.0.4
Published
A simple utility to get the current local date and time in ISO format with timezone offset.
Downloads
87
Readme
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-timestampUsage
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)