Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sundial

Package Overview
Dependencies
Maintainers
2
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sundial - npm Package Compare versions

Comparing version 1.5.1 to 1.6.0

45

lib/datetimeWrapper.js

@@ -46,2 +46,5 @@ // == BDS2 LICENSE ==

applyOffset: function(timestamp, offset) {
if (!timestamp) {
throw new Error('No timestamp provided as first argument!');
}
return moment.utc(timestamp).add(offset, 'minutes').toDate();

@@ -58,2 +61,5 @@ },

applyTimezone: function(timestamp, timezone) {
if (!timestamp) {
throw new Error('No timestamp provided as first argument!');
}
this.checkTimezoneName(timezone);

@@ -84,2 +90,5 @@ // NB: the result of this method will *not* yield the correct timezone offset from .getTimezoneOffset()

applyTimezoneAndConversionOffset: function(timestamp, timezone, conversionOffset) {
if (!timestamp) {
throw new Error('No timestamp provided as first argument!');
}
this.checkTimezoneName(timezone);

@@ -166,2 +175,5 @@ // NB: the result of this method will *not* yield the correct timezone offset from .getTimezoneOffset()

findTimeFromDeviceTimeAndOffsets: function(dt, timezoneOffset, conversionOffset) {
if (!dt) {
throw new Error('No Date provided as first argument!');
}
return moment.utc(dt)

@@ -196,2 +208,5 @@ .subtract(timezoneOffset, 'minutes')

formatDeviceTime: function(dt) {
if (!dt) {
throw new Error('No datetime provided as first argument!');
}
// use of .utc() here is for cross-browser consistency

@@ -210,2 +225,5 @@ return _applyMask(moment.utc(dt), 'YYYY-MM-DDTHH:mm:ss');

formatFromOffset: function(timestamp, offset, mask) {
if (!timestamp) {
throw new Error('No timestamp provided as first argument!');
}
mask = mask || DEFAULT_DISPLAY_MASK;

@@ -222,2 +240,5 @@ return _applyMask(moment(timestamp).utcOffset(offset), mask);

formatCalendarTime: function(dt) {
if (!dt) {
throw new Error('No datetime provided as first argument!');
}
return moment(dt).calendar();

@@ -234,2 +255,5 @@ },

formatForStorage: function(timestamp, offset) {
if (!timestamp) {
throw new Error('No timestamp provided as first argument!');
}
return moment(timestamp).utcOffset(offset).format();

@@ -247,2 +271,5 @@ },

formatInTimezone: function(timestamp, timezone, mask) {
if (!timestamp) {
throw new Error('No timestamp provided as first argument!');
}
this.checkTimezoneName(timezone);

@@ -270,2 +297,5 @@ timezone = timezone || '';

getMsFromMidnight: function(dt, offset) {
if (!dt) {
throw new Error('No datetime provided as first argument!');
}
// this function is used mainly for deciding when an event matches a device setting

@@ -299,2 +329,5 @@ // since devices report setting start times in milliseconds from midnight, device's local time

getOffsetFromTime: function(timestamp) {
if (!timestamp) {
throw new Error('No timestamp provided as first argument!');
}
function containsZone() {

@@ -315,2 +348,5 @@ var zonePattern = /^([+-][0-2]\d:[0-5]\d)$/;

getOffsetFromZone: function(timestamp, timezone) {
if (!timestamp) {
throw new Error('No timestamp provided as first argument!');
}
this.checkTimezoneName(timezone);

@@ -410,2 +446,5 @@ return moment.utc(timestamp).tz(timezone).utcOffset();

getUTCFromLocalTimeAndTimezone: function(timestamp, timezone) {
if (!timestamp) {
throw new Error('No timestamp provided as first argument!');
}
if (!timezone) {

@@ -463,2 +502,5 @@ throw new Error('A timezone is required!');

parseFromFormat: function(timestamp, format, timezone) {
if (!timestamp) {
throw new Error('No timestamp provided as first argument!');
}
this.checkTimezoneName(timezone);

@@ -483,2 +525,5 @@ if (timezone == null) {

translateMask: function(timestr, inputMask, outputMask) {
if (!timestr) {
throw new Error('No datetime provided as first argument!');
}
var res = moment(timestr, inputMask).format(outputMask);

@@ -485,0 +530,0 @@ if (res !== 'Invalid date') {

2

package.json
{
"name": "sundial",
"version": "1.5.1",
"version": "1.6.0",
"description": "Tidepool's datetime wrapper",

@@ -5,0 +5,0 @@ "keywords": [

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