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

browser-tz

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

browser-tz - npm Package Compare versions

Comparing version 0.2.2 to 0.3.1

8

add.js

@@ -44,2 +44,3 @@ var moment = require("moment-timezone/moment-timezone.js")

if (!isoDate) {
// console.log("BAD DATE", date)
return "BAD DATE"

@@ -113,2 +114,3 @@ }

if (!time) {
// console.log("BAD DATE", String(time))
return "BAD DATE"

@@ -126,2 +128,3 @@ }

if (localISO === "BAD DATE") {
// console.log("BAD DATE", date)
return localISO

@@ -139,3 +142,6 @@ }

var targetDate = addNoTimezone(type, { iso: localISO }, amount)
// console.log("targetDate", targetDate)
if (targetDate.indexOf("NaN") !== -1) {
// console.log("targetDate", targetDate, isoDate, localISO, date)
}
return IsoString({ iso: targetDate, timezone: date.timezone })

@@ -142,0 +148,0 @@ }

2

iso-date/parse.js

@@ -9,3 +9,3 @@ var isISOString = new RegExp(

"\\.?(\\d\\d\\d)?" + // optional milliseconds
"(Z|(\\-\\d\\d:\\d\\d))?" // optional timezone information
"(Z|([\\-\\+]\\d\\d:\\d\\d))?" // optional timezone information
)

@@ -12,0 +12,0 @@

@@ -17,2 +17,3 @@ var moment = require("moment-timezone/moment-timezone.js")

if (!isoDate) {
// console.log("BAD DATE", date)
return "BAD DATE"

@@ -19,0 +20,0 @@ }

{
"name": "browser-tz",
"version": "0.2.2",
"version": "0.3.1",
"description": "Timezone specific manipulation of datetime strings",

@@ -20,6 +20,8 @@ "keywords": [],

"dependencies": {
"moment-timezone": "0.0.2"
"moment-timezone": "0.0.2",
"tape": "~1.0.4"
},
"devDependencies": {
"tape": "~1.0.2"
"tape": "git://github.com/Raynos/tape",
"function-bind": "~0.1.0"
},

@@ -26,0 +28,0 @@ "licenses": [

@@ -53,11 +53,2 @@ # browser-tz

## Todo
- Test `IsoString` for timezones that have +30m/-30m offsets
- Test `IsoString` in exotic timezones where it's not a normal
DST change
- Test `addMinute` for timezones that have +30m/-30m offsets
- Test `addHour` in exotic timezones where it's not a normal
DST change
## The timezone strategy

@@ -64,0 +55,0 @@

@@ -112,13 +112,12 @@ var test = require("tape")

})
// assertDSTBoundary(assert, "minute", {
// iso: "2013-10-05T15:30:00Z",
// timezone: "Australia/Lord_Howe"
// })
// console.log("Australia/Lord_Howe --------------------------")
// assertDSTBoundary(assert, "minute", {
// iso: "2013-04-06T15:00:00Z",
// timezone: "Australia/Lord_Howe"
// })
// console.log("Australia/Lord_Howe --------------------------")
assertDSTBoundary(assert, "minute", {
iso: "2013-10-05T15:30:00Z",
timezone: "Australia/Lord_Howe"
})
assertDSTBoundary(assert, "minute", {
iso: "2013-04-06T15:00:00Z",
timezone: "Australia/Lord_Howe"
})
assert.end()

@@ -198,2 +197,16 @@ })

assert.equal(tz.addDay({
iso: "2013-10-05T02:00:00.000+10:30",
timezone: "Australia/Lord_Howe"
}, 1), "2013-10-06T02:30:00.000+11:00")
assertDSTBoundary(assert, "day", {
iso: "2013-10-05T15:30:00Z",
timezone: "Australia/Lord_Howe"
})
assertDSTBoundary(assert, "day", {
iso: "2013-04-06T15:00:00Z",
timezone: "Australia/Lord_Howe"
})
assert.end()

@@ -406,2 +419,8 @@ })

Object.keys(expectedTimes).forEach(function (key) {
var time = expectedTimes[key]
assert.notEqual(time, "BAD DATE")
})
function assertTimeOperation(start, end) {

@@ -408,0 +427,0 @@ var direction = typeof end !== "string" ? end - start :

var test = require("tape")
if (!Function.prototype.bind) {
Function.prototype.bind = function (context) {
var args = [].slice.call(arguments, 1)
var fn = this
return function () {
return fn.apply(null, args.concat([].slice.call(arguments)))
}
}
Function.prototype.bind = require("function-bind")
}

@@ -13,0 +6,0 @@

@@ -6,3 +6,2 @@ var test = require("tape")

test("single test", function (assert) {
console.log("----------------------- Australia/Lord_Howe -----------------")
assert.equal(tz.IsoString({

@@ -12,3 +11,2 @@ iso: "2013-10-06T02:00:00",

}), "2013-10-06T02:30:00.000+11:00")
console.log("----------------------- America/Toronto ---------------------")
assert.equal(tz.IsoString({

@@ -15,0 +13,0 @@ iso: "2013-03-10T02:00:00",

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