New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

shift-timezone-offset

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

shift-timezone-offset - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

.drone.yml

3

index.js
var localOffset = new Date().getTimezoneOffset()
var maxOffset = 14 * 60
var parseOffset = require('./parse-time-offset')

@@ -43,3 +44,3 @@

if(typeof timezoneData == 'number')
if(typeof timezoneData == 'number' && Math.abs(timezoneData) <= maxOffset)
return timezoneData

@@ -46,0 +47,0 @@

{
"name": "shift-timezone-offset",
"version": "0.0.2",
"version": "0.0.3",
"description": "Shift timezoned dates to local time or any other timezone.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -1,2 +0,2 @@

# timezone-offsets
# shift-timezone-offset

@@ -64,3 +64,3 @@ Converts timezoned dates to local time or any other timezone.

// shifting 5 hours
// 5 hours timezone shift
console.log(timezoneShift.convert(dateInfo, { from: '+03:00', to: '+08:00' }))

@@ -70,11 +70,11 @@ // => 2017-01-01T04:00:00.000Z

// to local (all 3 are similar)
// local timezone is default:
// "to" defaults to local timezone:
console.log(timezoneShift.convert(dateInfo, { from: '+03:00' }))
// => 2017-01-01T01:00:00.000Z
// to check:
// to be sure:
console.log(timezoneShift.convert(dateInfo, { from: '+03:00', to: '+11:00' }))
// => 2017-01-01T01:00:00.000Z
// even simpler (from timezone is infered from date string):
// even simpler ("from" timezone is infered from date string):
console.log(timezoneShift.convert(dateInfo))

@@ -91,5 +91,5 @@ // => 2017-01-01T01:00:00.000Z

### `var converter = timezoneShift(validTimezone)`
## `var converter = timezoneShift(validTimezone)`
* `validTimezone` - valid ISO 8601 date string or timezone string: `'+05:00'`, `'-1100'` or `'2017-01-01T12:00:00+05:00'`.
* `validTimezone` - valid ISO 8601 date string or timezone string: `'+05:00'`, `'-1100'` or `'2017-01-01T12:00:00+05:00'`. An offset is valid as well: `-240` in place of `'+04:00`.

@@ -127,2 +127,10 @@ ### `converter.toLocal(date)`

## `timezoneShift.convert(date, zones)`
* `date` - any valid value for the `Date` object constructor.
* `zone` - object containing initial and final timezones:
* `zones.from` - valid timezone info. Could be infered if `date` is an ISO date string.
* `zones.to` - default: local timezone. Valid timezone info.
# license

@@ -129,0 +137,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc