1.1.3 • Published 6 years ago

uk-time v1.1.3

Weekly downloads
47
License
ISC
Repository
github
Last release
6 years ago

uk-time

Build Status

A Javascript module purely for converting to and from UK time.

Installation

$ npm install uk-time

Usage

There are two methods:

  • toUKTime(dateTimeString, [outputStringTemplate]) - parses the input string as a UTC datetime and converts it to a string of the equivalent datetime in the UK. It will format the output string with the optional template, defaulting to ISO format.
  • fromUKTime(dateTimeString, [outputStringTemplate]) - parses the input string as a UK datetime and converts it to a string of the equivalent UTC datetime. It will format the output string with the given optional template, defaulting to ISO format.

Examples

const { toUKTime, fromUKTime } = require('uk-time'); //CommonJS
import { toUKTime, fromUKTime } from 'uk-time'; //ES6 modules

// Basic to UK (from UTC) usage
toUKTime('2014-01-01T12:00:00Z');
// 2014-01-01T12:00:00Z

// Basic from UK (to UTC) usage
fromUKTime('2014-08-01T13:00:00Z');
// 2014-08-01T12:00:00Z

// Format output of to UK (from UTC) usage
toUKTime('2014-08-01T12:00:00Z', 'dddd, mmmm dS, yyyy, h:MM:ss TT');
// Friday, August 1st, 2014, 13:00:00 PM

// Format output of to UK (from UTC) usage
fromUKTime('2014-08-01T13:00:00Z', 'dddd, mmmm dS, yyyy, h:MM:ss TT');
// Friday, August 1st, 2014, 12:00:00 PM

Formatting

Formatting of output strings is done using dateFormat. Any masks used with dateFormat will work with uk-time.

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago