Socket
Socket
Sign inDemoInstall

timezone

Package Overview
Dependencies
0
Maintainers
1
Versions
67
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.13 to 0.0.14

CHANGELOG

4

Africa/index.js

@@ -9,3 +9,3 @@ // Load all of the modules in a directory and any sub-directories. Used to

var skip, path, stat;
skip = skip || /^(index.js|rfc822.js|slurp.js|synopsis.js|timezone.js|zones.js|README)$/.test(file);
skip = skip || /^(index.js|rfc822.js|slurp.js|synopsis.js|timezone.js|zones.js|loaded.js|README)$/.test(file);
skip = skip || /^[._]/.test(file);

@@ -19,3 +19,3 @@ skip = skip || (exclude && exclude.test(file));

glob(exports, path);
} else {
} else if (/\.js$/.test(file)) {
exports.push(require(path));

@@ -22,0 +22,0 @@ }

@@ -9,3 +9,3 @@ // Load all of the modules in a directory and any sub-directories. Used to

var skip, path, stat;
skip = skip || /^(index.js|rfc822.js|slurp.js|synopsis.js|timezone.js|zones.js|README)$/.test(file);
skip = skip || /^(index.js|rfc822.js|slurp.js|synopsis.js|timezone.js|zones.js|loaded.js|README)$/.test(file);
skip = skip || /^[._]/.test(file);

@@ -19,3 +19,3 @@ skip = skip || (exclude && exclude.test(file));

glob(exports, path);
} else {
} else if (/\.js$/.test(file)) {
exports.push(require(path));

@@ -22,0 +22,0 @@ }

@@ -9,3 +9,3 @@ // Load all of the modules in a directory and any sub-directories. Used to

var skip, path, stat;
skip = skip || /^(index.js|rfc822.js|slurp.js|synopsis.js|timezone.js|zones.js|README)$/.test(file);
skip = skip || /^(index.js|rfc822.js|slurp.js|synopsis.js|timezone.js|zones.js|loaded.js|README)$/.test(file);
skip = skip || /^[._]/.test(file);

@@ -19,3 +19,3 @@ skip = skip || (exclude && exclude.test(file));

glob(exports, path);
} else {
} else if (/\.js$/.test(file)) {
exports.push(require(path));

@@ -22,0 +22,0 @@ }

@@ -9,3 +9,3 @@ // Load all of the modules in a directory and any sub-directories. Used to

var skip, path, stat;
skip = skip || /^(index.js|rfc822.js|slurp.js|synopsis.js|timezone.js|zones.js|README)$/.test(file);
skip = skip || /^(index.js|rfc822.js|slurp.js|synopsis.js|timezone.js|zones.js|loaded.js|README)$/.test(file);
skip = skip || /^[._]/.test(file);

@@ -19,3 +19,3 @@ skip = skip || (exclude && exclude.test(file));

glob(exports, path);
} else {
} else if (/\.js$/.test(file)) {
exports.push(require(path));

@@ -22,0 +22,0 @@ }

@@ -9,3 +9,3 @@ // Load all of the modules in a directory and any sub-directories. Used to

var skip, path, stat;
skip = skip || /^(index.js|rfc822.js|slurp.js|synopsis.js|timezone.js|zones.js|README)$/.test(file);
skip = skip || /^(index.js|rfc822.js|slurp.js|synopsis.js|timezone.js|zones.js|loaded.js|README)$/.test(file);
skip = skip || /^[._]/.test(file);

@@ -19,3 +19,3 @@ skip = skip || (exclude && exclude.test(file));

glob(exports, path);
} else {
} else if (/\.js$/.test(file)) {
exports.push(require(path));

@@ -22,0 +22,0 @@ }

@@ -9,3 +9,3 @@ // Load all of the modules in a directory and any sub-directories. Used to

var skip, path, stat;
skip = skip || /^(index.js|rfc822.js|slurp.js|synopsis.js|timezone.js|zones.js|README)$/.test(file);
skip = skip || /^(index.js|rfc822.js|slurp.js|synopsis.js|timezone.js|zones.js|loaded.js|README)$/.test(file);
skip = skip || /^[._]/.test(file);

@@ -19,3 +19,3 @@ skip = skip || (exclude && exclude.test(file));

glob(exports, path);
} else {
} else if (/\.js$/.test(file)) {
exports.push(require(path));

@@ -22,0 +22,0 @@ }

@@ -9,3 +9,3 @@ // Load all of the modules in a directory and any sub-directories. Used to

var skip, path, stat;
skip = skip || /^(index.js|rfc822.js|slurp.js|synopsis.js|timezone.js|zones.js|README)$/.test(file);
skip = skip || /^(index.js|rfc822.js|slurp.js|synopsis.js|timezone.js|zones.js|loaded.js|README)$/.test(file);
skip = skip || /^[._]/.test(file);

@@ -19,3 +19,3 @@ skip = skip || (exclude && exclude.test(file));

glob(exports, path);
} else {
} else if (/\.js$/.test(file)) {
exports.push(require(path));

@@ -22,0 +22,0 @@ }

@@ -9,3 +9,3 @@ // Load all of the modules in a directory and any sub-directories. Used to

var skip, path, stat;
skip = skip || /^(index.js|rfc822.js|slurp.js|synopsis.js|timezone.js|zones.js|README)$/.test(file);
skip = skip || /^(index.js|rfc822.js|slurp.js|synopsis.js|timezone.js|zones.js|loaded.js|README)$/.test(file);
skip = skip || /^[._]/.test(file);

@@ -19,3 +19,3 @@ skip = skip || (exclude && exclude.test(file));

glob(exports, path);
} else {
} else if (/\.js$/.test(file)) {
exports.push(require(path));

@@ -22,0 +22,0 @@ }

@@ -9,3 +9,3 @@ // Load all of the modules in a directory and any sub-directories. Used to

var skip, path, stat;
skip = skip || /^(index.js|rfc822.js|slurp.js|synopsis.js|timezone.js|zones.js|README)$/.test(file);
skip = skip || /^(index.js|rfc822.js|slurp.js|synopsis.js|timezone.js|zones.js|loaded.js|README)$/.test(file);
skip = skip || /^[._]/.test(file);

@@ -19,3 +19,3 @@ skip = skip || (exclude && exclude.test(file));

glob(exports, path);
} else {
} else if (/\.js$/.test(file)) {
exports.push(require(path));

@@ -22,0 +22,0 @@ }

@@ -9,3 +9,3 @@ // Load all of the modules in a directory and any sub-directories. Used to

var skip, path, stat;
skip = skip || /^(index.js|rfc822.js|slurp.js|synopsis.js|timezone.js|zones.js|README)$/.test(file);
skip = skip || /^(index.js|rfc822.js|slurp.js|synopsis.js|timezone.js|zones.js|loaded.js|README)$/.test(file);
skip = skip || /^[._]/.test(file);

@@ -19,3 +19,3 @@ skip = skip || (exclude && exclude.test(file));

glob(exports, path);
} else {
} else if (/\.js$/.test(file)) {
exports.push(require(path));

@@ -22,0 +22,0 @@ }

@@ -9,3 +9,3 @@ // Load all of the modules in a directory and any sub-directories. Used to

var skip, path, stat;
skip = skip || /^(index.js|rfc822.js|slurp.js|synopsis.js|timezone.js|zones.js|README)$/.test(file);
skip = skip || /^(index.js|rfc822.js|slurp.js|synopsis.js|timezone.js|zones.js|loaded.js|README)$/.test(file);
skip = skip || /^[._]/.test(file);

@@ -19,3 +19,3 @@ skip = skip || (exclude && exclude.test(file));

glob(exports, path);
} else {
} else if (/\.js$/.test(file)) {
exports.push(require(path));

@@ -22,0 +22,0 @@ }

!function (definition) {
if (typeof module == "object" && module.exports) module.exports = definition();
else if (typeof define == "function" && typeof define.amd == "object") define(definition);
if (module && module.exports) module.exports = definition();
else if (typeof define == "function") define(definition);
else this.tz = definition();
} (function () {
var __slice = [].slice, __push = [].push;
var __slice = [].slice;
/*

@@ -17,6 +17,6 @@ function die () {

var wallclock = new Date(convertToWallclock(request, posix));
return rest.replace(/%([-0_^]?)(:{0,3})(\d*)(.)/g, function (matched, flag, colons, padding, specifier) {
var f, value = matched, fill = "0", pad;
return rest.replace(/%([-0_^]?)(:{0,3})(\d*)(.)/g, function (value, flag, colons, padding, specifier) {
var f, fill = "0", pad;
if (f = request[specifier]) {
value = String(f.call(request, wallclock, posix, flag, (colons || "").length));
value = String(f.call(request, wallclock, posix, flag, colons.length));
if ((flag || f.style) == "_") fill = " ";

@@ -34,21 +34,17 @@ pad = flag == "-" ? 0 : f.pad || 0;

function makeDate (request, date) {
var posix = date[7], i;
for (i = 0; i < 11; i++) date[i] = +(date[i] || 0); // conversion necessary for decrement
function make (date) {
for (var i = 0; i < 11; i++) date[i] = +(date[i] || 0); // conversion necessary for decrement
--date[1];
date = Date.UTC.apply(Date.UTC, date.slice(0, 8)) + -date[7] * (date[8] * 36e5 + date[9] * 6e4 + date[10] * 1e3);
if (!posix) date = convertToPOSIX(request, date);
if (date == null) throw new Error("invalid wall-clock time");
return date;
return Date.UTC.apply(Date.UTC, date.slice(0, 8)) + -date[7] * (date[8] * 36e5 + date[9] * 6e4 + date[10] * 1e3);
}
function parse (pattern) {
var date = [ "@" ], match;
var date = [], match;
if (match = /^(\d{4})-(\d{2})-(\d{2})(?:[T\s](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?(Z|(([+-])(\d{2}(:\d{2}){0,2})))?)?$/.exec(pattern)) {
__push.apply(date, match.slice(1, 8));
date.push.apply(date, match.slice(1, 8));
if (match[9]) {
__push.apply(date, [match[10] + 1]);
__push.apply(date, match[11].split(/:/));
date.push(match[10] + 1);
date.push.apply(date, match[11].split(/:/));
} else if (match[8]) {
__push.apply(date, [ 1 ]);
date.push(1);
}

@@ -63,8 +59,8 @@ return date;

do {
fields = new Date(Date.UTC(year, rule.month, Math.abs(date++)));
} while (rule.day[0] < 7 && fields.getUTCDay() != rule.day[0])
actualized = new Date(Date.UTC(year, rule.month, Math.abs(date++)));
} while (rule.day[0] < 7 && actualized.getUTCDay() != rule.day[0])
actualized = {
clock: rule.clock,
sortable: fields.getTime(),
sort: actualized.getTime(),
rule: rule,

@@ -75,8 +71,8 @@ save: rule.save * 6e4,

actualized[actualized.clock] = fields.getTime() + rule.time * 6e4;
actualized[actualized.clock] = actualized.sort + rule.time * 6e4;
if (actualized.clock == "posix") {
actualized.wallclock = actualized.posix + (entry.offset + rule.saved);
if (actualized.posix) {
actualized.wallclock = actualized[actualized.clock] + (entry.offset + rule.saved);
} else {
actualized.posix = actualized.wallclock - (entry.offset + rule.saved);
actualized.posix = actualized[actualized.clock] - (entry.offset + rule.saved);
}

@@ -103,3 +99,3 @@

function find (request, clock, time) {
var i, I, entry, year = new Date(time).getUTCFullYear(), found, zone = request[request.zone], actualized = [], to, abbrevs, rules;
var i, I, entry, found, zone = request[request.zone], actualized = [], foo, rules;
for (i = 1, I = zone.length; i < I; i++) if (zone[i][clock] <= time) break;

@@ -109,5 +105,5 @@ entry = zone[i];

rules = request[entry.rules];
to = applicable(entry, rules, actualized, time);
if (to != null) applicable(entry, rules, actualized, Date.UTC(to, 5));
actualized.sort(function (a, b) { return a.sortable - b.sortable });
foo = applicable(entry, rules, actualized, time);
if (foo != null) applicable(entry, rules, actualized, Date.UTC(foo, 5));
actualized.sort(function (a, b) { return a.sort - b.sort });
for (i = 0, I = actualized.length; i < I; i++) {

@@ -118,4 +114,4 @@ if (time >= actualized[i][clock] && actualized[i][actualized[i].clock] > entry[actualized[i].clock]) found = actualized[i];

if (found) {
if (abbrevs = /^(.*)\/(.*)$/.exec(entry.format)) {
found.abbrev = abbrevs[found.save ? 2 : 1];
if (foo = /^(.*)\/(.*)$/.exec(entry.format)) {
found.abbrev = foo[found.save ? 2 : 1];
} else {

@@ -179,10 +175,7 @@ found.abbrev = entry.format.replace(/%s/, found.rule.letter);

function convert (vargs) {
if (!vargs.length) return "0.0.11";
if (!vargs.length) return "0.0.14";
var i, I, argument, date, type
, request = Object.create(this)
, zone, locale
var request = Object.create(this)
, adjustments = []
, parsed
, extra = []
, i, foo, bar, argument, date
;

@@ -193,6 +186,4 @@

// https://twitter.com/bigeasy/status/215112186572439552
if (argument == null) {
throw new Error("null argument");
} else if (Array.isArray(argument)) {
if (!i && argument[0] == "@") {
if (Array.isArray(argument)) {
if (!i && !isNaN(argument[1])) {
date = argument;

@@ -203,22 +194,20 @@ } else {

}
} else if (isNaN(argument) && (i || argument != "*")) {
type = typeof argument;
if (type == "string") {
} else if (isNaN(argument)) {
foo = typeof argument;
if (foo == "string") {
if (~argument.indexOf("%")) {
request.format = argument;
} else if (!i && (parsed = parse(argument))) {
date = parsed;
} else if (!i && argument == "*") {
date = argument;
} else if (!i && (foo = parse(argument))) {
date = foo;
} else if (/^\w{2}_\w{2}$/.test(argument)) {
if (locale) extra.push(argument);
else locale = argument;
} else if (parsed = parseAdjustment(argument)) {
adjustments.push(parsed);
} else if (/^[-A-Za-z\/_]+$|^\w{3}\d\w{3}$/.test(argument)) {
if (!zone) zone = argument;
else extra.push(argument);
request.locale = argument;
} else if (foo = parseAdjustment(argument)) {
adjustments.push(foo);
} else {
throw new Error("invalid argument: " + argument);
}
} else if (type == "function") {
if (parsed = argument.call(request)) return parsed;
request.zone = argument;
}
} else if (foo == "function") {
if (foo = argument.call(request)) return foo;
} else if (/^\w{2}_\w{2}$/.test(argument.name)) {

@@ -232,19 +221,8 @@ request[argument.name] = argument;

date = argument;
} else {
throw new Error("invalid argument: " + argument);
}
}
if (locale) {
if (!request[locale]) throw new Error("invalid locale: " + locale);
request.locale = locale;
}
if (!request[request.locale]) delete request.locale;
if (!request[request.zone]) delete request.zone;
if (zone) {
if (!request[zone] || request[zone][0] != "z") throw new Error("invalid zone: " + zone);
request.zone = zone;
}
if (extra.length) return request.convert(date == null ? extra : [ date, extra ]);
if (date != null) {

@@ -254,13 +232,18 @@ if (date == "*") {

} else if (Array.isArray(date)) {
if (isNaN(date = makeDate(request, date.slice(1))))
throw new Error("invalid date");
bar = !date[7];
date = make(date);
} else {
date = Math.floor(date);
}
if (!isNaN(date)) {
if (bar) date = convertToPOSIX(request, date);
for (i = 0, I = adjustments.length; i < I; i++) {
date = adjustments[i](request, date);
if (date == null) return date;
for (i = 0, bar = adjustments.length; i < bar; i++) {
date = adjustments[i](request, date);
}
return request.format ? format(request, date, request.format) : date;
}
return request.format ? format(request, date, request.format) : date;
}

@@ -272,7 +255,6 @@

var context =
{ zone: "UTC"
{ clock: function () { return +(new Date()) }
, zone: "UTC"
, entry: { abbrev: "UTC", offset: 0, save: 0 }
, UTC: [ "z" ]
, clock: function () { return +(new Date()) }
, convert: convert
, UTC: 1
, z: function(date, posix, flag, delimiters) {

@@ -343,2 +325,3 @@ var offset = this.entry.offset + this.entry.save

, c: function (date, posix) { return this.convert([ posix, this[this.locale].dateTime ]) }
, convert: convert
, locale: "en_US"

@@ -361,5 +344,5 @@ , en_US: {

};
var UNITS = "Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|year|month|day|hour|minute|second|milli|millisecond"
var UNITS = "Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|year|month|day|hour|minute|second|millisecond"
, UNIT_RE = new RegExp("^\\s*([+-])(\\d+)\\s+(" + UNITS + ")s?\\s*$", "i")
, TIME = [ 36e5, 6e4, 1e3, 1, 1 ]
, TIME = [ 36e5, 6e4, 1e3, 1 ]
;

@@ -366,0 +349,0 @@ UNITS = UNITS.toLowerCase().split("|");

@@ -9,3 +9,3 @@ // Load all of the modules in a directory and any sub-directories. Used to

var skip, path, stat;
skip = skip || /^(index.js|rfc822.js|slurp.js|synopsis.js|timezone.js|zones.js|README)$/.test(file);
skip = skip || /^(index.js|rfc822.js|slurp.js|synopsis.js|timezone.js|zones.js|loaded.js|README)$/.test(file);
skip = skip || /^[._]/.test(file);

@@ -19,3 +19,3 @@ skip = skip || (exclude && exclude.test(file));

glob(exports, path);
} else {
} else if (/\.js$/.test(file)) {
exports.push(require(path));

@@ -22,0 +22,0 @@ }

@@ -9,3 +9,3 @@ // Load all of the modules in a directory and any sub-directories. Used to

var skip, path, stat;
skip = skip || /^(index.js|rfc822.js|slurp.js|synopsis.js|timezone.js|zones.js|README)$/.test(file);
skip = skip || /^(index.js|rfc822.js|slurp.js|synopsis.js|timezone.js|zones.js|loaded.js|README)$/.test(file);
skip = skip || /^[._]/.test(file);

@@ -19,3 +19,3 @@ skip = skip || (exclude && exclude.test(file));

glob(exports, path);
} else {
} else if (/\.js$/.test(file)) {
exports.push(require(path));

@@ -22,0 +22,0 @@ }

@@ -9,3 +9,3 @@ // Load all of the modules in a directory and any sub-directories. Used to

var skip, path, stat;
skip = skip || /^(index.js|rfc822.js|slurp.js|synopsis.js|timezone.js|zones.js|README)$/.test(file);
skip = skip || /^(index.js|rfc822.js|slurp.js|synopsis.js|timezone.js|zones.js|loaded.js|README)$/.test(file);
skip = skip || /^[._]/.test(file);

@@ -19,3 +19,3 @@ skip = skip || (exclude && exclude.test(file));

glob(exports, path);
} else {
} else if (/\.js$/.test(file)) {
exports.push(require(path));

@@ -22,0 +22,0 @@ }

{ "name": "timezone"
, "description": "Small, elegant, Olson educated, timezone aware date math and `strftime` date formatting in pure JavaScript with no dependendcies for Node.js and the browser. Timezone uses the Olson/IANA timezone database. Timezone is aware of every clock transition in the Olson database. Timezones supports the full compilment of `strftime` format specifiers defined by GNU `date`. Timezone can perform date math and adjust for daylight savings time. Timezone works in the browser too where it is less than 3K minified and gzipped."
, "version": "0.0.13"
, "version": "0.0.14"
, "homepage": "http://bigeasy.github.com/timezone"

@@ -8,7 +8,7 @@ , "repository": "git://github.com/bigeasy/timezone.git"

, "url" : "http://bigeasy.github.com/timezone"
, "keywords" : ["time", "timezone", "date", "tzdata", "utc", "gmt", "datetime", "tz", "format", "events", "calendar"]
, "keywords" : ["time", "timezone", "date", "clock", "wall-clock", "tzdata", "utc", "gmt", "datetime", "tz", "format", "events", "calendar"]
, "author" : "Alan Gutierrez <alan@prettyrobots.com>"
, "contributors" : []
, "dependencies" : {}
, "devDependencies": { "proof": "0.0.5" }
, "devDependencies": { "proof": "0.0.5", "uglify-js": "~1.3" }
, "lib" : "lib"

@@ -15,0 +15,0 @@ , "main" : "./lib/timezone"

@@ -46,4 +46,4 @@ // A full RFC 2822 date parser for use with **Timezone**.

!function (definition) {
if (typeof module == "object" && module.exports) module.exports = definition();
else if (typeof define == "function" && typeof define.amd == "object") define(definition);
if (module && module.exports) module.exports = definition();
else if (typeof define == "function") define(definition);
else this.tz = definition();

@@ -200,8 +200,6 @@ } (function () {

date[1]++;
++date[1];
date.unshift("@");
return date;
}
});

@@ -41,4 +41,4 @@ // A walk-though of **Timezone**, a database friendly, timezone aware replacement

// POSIX time is absolute. It always represents a time in UTC. It doesn't spring
// forward or fall back. It's not affected by changes to boundaries or
// governments. It is a millisecond in the grand time line.
// forward or fall back. It's not affected by the decisions of local
// governments or administrators. It is a millisecond in the grand time line.
//

@@ -49,3 +49,3 @@ // POSIX time is simple. It is always an integer, making it easy to store in

// Because POSIX is an integer, it time is easy to sort and easy to compare.
// Sorting and searching POSIX time integers is fast.
// Sorting and searching POSIX time is fast.

@@ -202,3 +202,4 @@ // *Timezone returns number representing POSIX time by default.*

// We can't do Amsterdam, however, because we didn't load its rule set.
// Amsterdam was an hour ahead of UTC at the time of the moon walk. We can't
// convert Amsterdam, however, because we didn't load its zone rule set.

@@ -211,3 +212,3 @@ // *Won't work, didn't load Amsterdam.*

// We can load Amsterdam's rules for just this conversion. Here we bot include
// We can load Amsterdam's rules for just this conversion. Here we both include
// the rules for Amsterdam with `require` and select using the timezone string

@@ -249,3 +250,3 @@ // `"Europe/Amsterdam"`.

// **Timezone** supports all of the GNU `date` extensions, including some date
// calcuations.
// calculations you won't find in JavaScript's `Date`.

@@ -270,12 +271,60 @@ // *Day of the year.*

// *Get the time zone abbreviation which is * `UTC` * by default.*
eq( tz(moonwalk, "%Z"), "UTC" );
// *Get the time zone offset RFC 822 style.*
eq( tz(moonwalk, "%z"), "+0000" );
// When you format a date string and name a zone rule set, the zone format
// specifiers show the effect of zone rule set.
// *Get the timezone offset abbreviation for Detroit.*
eq( us(moonwalk, "America/Detroit", "%Z"), "EST" );
// *Timezone offset RFC 822 style.*
eq( us(moonwalk, "America/Detroit", "%z"), "-0500" );
// *Timezone offset colon separted.*
// **Timezone** supports the GNU extensions to the time zone offset format
// specifier `%z`. If you put colons between the `%` and `z` colons appear in
// the time zone offset.
// *Timezone offset colon separted, down to the second.*
// *Timezone offset colon separated.*
eq( us(moonwalk, "America/Detroit", "%:z"), "-05:00" );
// **Timezone** offers one extension to the GNU format secpifiers.
// Some time zone rules specify the time zone offset down to the second. None of
// the contemporary rules are that precise, but in history of standardized time,
// there where some time zone offset sticklers, like the Dutch Railways.
// *Timezone offset colon separted, down to the second, only if needed.*
// *The time at which the end of the First World War came into effect.*
var armistice = tz("1911-11-11 11:00");
// *Timezone offset colon separated, down to the second.*
eq( tz("1969-07-21 03:56", "Europe/Amsterdam", require("timezone/Europe/Amsterdam"), "%c")
, "-04:00:00" );
// The **Timezone** function itself offers one extension to `strftime`, inspired
// by the GNU `date` extensions for `%z`, to support formatting RFC 3999 date
// strings. The format specifier `%^z` flexibly formats the time zone offset.
// *Format UTC as* `Z` *instead of* `+00:00` *.*
eq( tz(moonwalk, "%^z"), "Z" );
// *Timezone offset colon separated, down to the minute.*
eq( us(moonwalk, "America/Detroit", "%^z"), "-04:00" );
// *Timezone offset colon separated, down to the second, only if needed.*
eq( tz(armistice, "Europe/Amsterdam", require("timezone/Europe/Amsterdam"), "%^z")
, "-04:00:00" );
// *RFC 3999 string for* `UTC` *.*
eq( tz(moonwalk, "%F %T%^z"), "-04:00" );
// *RFC 3999 string not at* `UTC` *.*
eq( us(moonwalk, "America/Detroit", "%F %T%^z"), "-04:00" );
// *Not part of the RFC 3999 standard, but **Timezone** will parse a time zone
// offset specified in seconds.*
eq( tz(armistice, "Europe/Amsterdam", require("timezone/Europe/Amsterdam"), "%T %F%^z")
, "-04:00:00" );
// #### Padding

@@ -285,14 +334,22 @@ //

// To remove padding, add a hyphen after the percent sign.
// To pad with spaces put an underscore after the percent sign.
// *Space padded day of month.*
eq( tz(ytk, "%B %_d %Y") );
// *Zero padded day of month.*
// For zero padding we use `0`, but most formats are already zero padded.
// *Zero padded day of month, but it is already zero padded.*
eq( tz(ytk, "%B %0d %Y"), "" );
// *Nanoseconds, silly because we only have millisecond prevision.*
eq( tz(1, "%T %F.%N"), "" );
// *Milliseconds using a with specifier.*
eq( tz(1, "%T %F.%03N"), "" );
// ### Converting to Wall-Clock Time
//
// TK Lost a nice draft of this. This was the gist.
//
// To convert to from POSIX time to wall-clock time, we format a date string

@@ -312,2 +369,3 @@ // specifying the name of a time zone rule set. The **Timezone** function

// *Convert to wall-clock time in and around Amsterdam.*
// TK Use armistice.
eq( eu(moonwalk, "%F %T", "Europe/Amsterdam")

@@ -384,3 +442,3 @@ , "1969-07-21 03:56:00" );

// Remember that we can only represent wallclock time using date strings. POSIX
// Remember that we can only represent wall-clock time using date strings. POSIX
// time is an absolute point in time and has no concept of timezone.

@@ -450,4 +508,4 @@

//
// Moving across daylight savings time by hour, minute, second or millsecond
// will adjust your wallclock time.
// Moving across daylight savings time by hour, minute, second or millisecond
// will adjust your wall-clock time.

@@ -472,11 +530,18 @@ // *Moving across daylight savings time by day lands at the same time.*

// The **Timezone** function will also accept an array of integers as a date
// intput. It will treat this value as wall-clock time and convert it according
// a specified time zone rule set.
// input. It will treat this value as wall-clock time and convert it according a
// specified time zone rule set.
//
// The date array is useful when working with GUI controls like a series of drop
// downs.
//
// The date array is also a good candidate for the output of a date parsing
// function. The date array is an easy data structure to populate
// programatically while parsing a date string.
// downs. It is also a good candidate for the output of a date parsing function.
// The date array is an easy data structure to populate programatically while
// parsing a date string.
//
// The elements `0` through `6` of the date array are year, month, date, hour,
// minute, second and milliseconds. If you leave an element `undefined`, it will
// be interpreted as zero. The date array must at contain at least a year and a
// month, a year alone will interpreted as POSIX time.
//
// Unlike the JavaScript `Date`, the **Timezone** function does not use a
// zero-based month index in an array representation of a date. It uses instead
// the humane month number that you'd find if you formatted the date.

@@ -488,6 +553,4 @@ //

// The date array format also allows you to specify a time zone offset. The
// elements `0` through `6` of the date array are year, month, date, hour,
// minute, second and milliseconds.
// The date array format also allows you to specify a time zone offset.
//
// If the element at index `7` is `1` or `-1`, that is treated as the time zone

@@ -599,3 +662,3 @@ // offset direction, `-1` for a negative time zone offset, `1` for a positive

// just that it is generally application specific, requires a lot of context,
// and it is not proptionate in complexity to date formatting, date math or time
// and it is not proportionate in complexity to date formatting, date math or time
// zone offset lookup. We might be able to hide a lot of the bulk in data files

@@ -602,0 +665,0 @@ // that accompany our library, but we would so

@@ -9,3 +9,3 @@ // Load all of the modules in a directory and any sub-directories. Used to

var skip, path, stat;
skip = skip || /^(index.js|rfc822.js|slurp.js|synopsis.js|timezone.js|zones.js|README)$/.test(file);
skip = skip || /^(index.js|rfc822.js|slurp.js|synopsis.js|timezone.js|zones.js|loaded.js|README)$/.test(file);
skip = skip || /^[._]/.test(file);

@@ -19,3 +19,3 @@ skip = skip || (exclude && exclude.test(file));

glob(exports, path);
} else {
} else if (/\.js$/.test(file)) {
exports.push(require(path));

@@ -22,0 +22,0 @@ }

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc