Socket
Socket
Sign inDemoInstall

date-fns-tz

Package Overview
Dependencies
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

date-fns-tz - npm Package Compare versions

Comparing version 3.0.0-beta.3 to 3.0.0-beta.4

esm/fp/fromZonedTime/index.d.ts

5

_lib/newDateUTC/index.js

@@ -6,3 +6,3 @@ "use strict";

});
exports["default"] = newDateUTC;
exports.newDateUTC = newDateUTC;
/**

@@ -20,3 +20,2 @@ * Use instead of `new Date(Date.UTC(...))` to support years below 100 which doesn't work

return utcDate;
}
module.exports = exports.default;
}

7

_lib/tzIntlTimeZoneName/index.js

@@ -6,3 +6,3 @@ "use strict";

});
exports["default"] = tzIntlTimeZoneName;
exports.tzIntlTimeZoneName = tzIntlTimeZoneName;
/**

@@ -35,3 +35,3 @@ * Returns the formatted time zone name of the provided `timeZone` or the current

if (locale && !locale.code) {
throw new Error("date-fns-tz error: Please set a language code on the locale object imported from date-fns, e.g. `locale.code = 'en-US'`");
throw new Error('date-fns-tz error: Please set a language code on the locale object imported from date-fns, e.g. `locale.code = \'en-US\'`');
}

@@ -42,3 +42,2 @@ return new Intl.DateTimeFormat(locale ? [locale.code, 'en-US'] : undefined, {

});
}
module.exports = exports.default;
}

@@ -6,6 +6,5 @@ "use strict";

});
exports["default"] = tzParseTimezone;
var _index = _interopRequireDefault(require("../tzTokenizeDate/index.js"));
var _index2 = _interopRequireDefault(require("../newDateUTC/index.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
exports.tzParseTimezone = tzParseTimezone;
var _tzTokenizeDate = require("../tzTokenizeDate");
var _newDateUTC = require("../newDateUTC");
var MILLISECONDS_IN_HOUR = 3600000;

@@ -70,9 +69,9 @@ var MILLISECONDS_IN_MINUTE = 60000;

function toUtcDate(date) {
return (0, _index2["default"])(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());
return (0, _newDateUTC.newDateUTC)(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());
}
function calcOffset(date, timezoneString) {
var tokens = (0, _index["default"])(date, timezoneString);
var tokens = (0, _tzTokenizeDate.tzTokenizeDate)(date, timezoneString);
// ms dropped because it's not provided by tzTokenizeDate
var asUTC = (0, _index2["default"])(tokens[0], tokens[1] - 1, tokens[2], tokens[3] % 24, tokens[4], tokens[5], 0).getTime();
var asUTC = (0, _newDateUTC.newDateUTC)(tokens[0], tokens[1] - 1, tokens[2], tokens[3] % 24, tokens[4], tokens[5], 0).getTime();
var asTS = date.getTime();

@@ -124,3 +123,2 @@ var over = asTS % 1000;

}
}
module.exports = exports.default;
}

@@ -6,6 +6,4 @@ "use strict";

});
exports["default"] = void 0;
exports.tzPattern = void 0;
/** Regex to identify the presence of a time zone specifier in a date string */
var tzPattern = /(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/;
var _default = exports["default"] = tzPattern;
module.exports = exports.default;
var tzPattern = exports.tzPattern = /(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/;

@@ -6,3 +6,3 @@ "use strict";

});
exports["default"] = tzTokenizeDate;
exports.tzTokenizeDate = tzTokenizeDate;
/**

@@ -89,3 +89,2 @@ * Returns the [year, month, day, hour, minute, seconds] tokens of the provided

return dtfCache[timeZone];
}
module.exports = exports.default;
}

@@ -8,3 +8,3 @@ /**

*/
export default function newDateUTC(fullYear, month, day, hour, minute, second, millisecond) {
export function newDateUTC(fullYear, month, day, hour, minute, second, millisecond) {
var utcDate = new Date(0)

@@ -11,0 +11,0 @@ utcDate.setUTCFullYear(fullYear, month, day)

@@ -6,3 +6,3 @@ /**

*/
export default function tzIntlTimeZoneName(length, date, options) {
export function tzIntlTimeZoneName(length, date, options) {
var dtf = getDTF(length, options.timeZone, options.locale)

@@ -33,3 +33,3 @@ return dtf.formatToParts ? partsTimeZone(dtf, date) : hackyTimeZone(dtf, date)

throw new Error(
"date-fns-tz error: Please set a language code on the locale object imported from date-fns, e.g. `locale.code = 'en-US'`"
'date-fns-tz error: Please set a language code on the locale object imported from date-fns, e.g. `locale.code = \'en-US\'`',
)

@@ -36,0 +36,0 @@ }

@@ -1,3 +0,3 @@

import tzTokenizeDate from '../tzTokenizeDate/index.js'
import newDateUTC from '../newDateUTC/index.js'
import { tzTokenizeDate } from '../tzTokenizeDate'
import { newDateUTC } from '../newDateUTC'

@@ -15,3 +15,3 @@ var MILLISECONDS_IN_HOUR = 3600000

// Parse various time zone offset formats to an offset in milliseconds
export default function tzParseTimezone(timezoneString, date, isUtcDate) {
export function tzParseTimezone(timezoneString, date, isUtcDate) {
var token

@@ -82,3 +82,3 @@ var absoluteOffset

date.getSeconds(),
date.getMilliseconds()
date.getMilliseconds(),
)

@@ -98,3 +98,3 @@ }

tokens[5],
0
0,
).getTime()

@@ -140,2 +140,3 @@

var validIANATimezoneCache = {}
function isValidTimezoneIANAString(timeZoneString) {

@@ -142,0 +143,0 @@ if (validIANATimezoneCache[timeZoneString]) return true

/** Regex to identify the presence of a time zone specifier in a date string */
var tzPattern = /(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/
export default tzPattern
export { tzPattern }

@@ -5,3 +5,3 @@ /**

*/
export default function tzTokenizeDate(date, timeZone) {
export function tzTokenizeDate(date, timeZone) {
var dtf = getDateTimeFormat(timeZone)

@@ -8,0 +8,0 @@ return dtf.formatToParts ? partsOffset(dtf, date) : hackyOffset(dtf, date)

@@ -1,3 +0,3 @@

import tzIntlTimeZoneName from '../../_lib/tzIntlTimeZoneName/index.js'
import tzParseTimezone from '../../_lib/tzParseTimezone/index.js'
import { tzIntlTimeZoneName } from '../../_lib/tzIntlTimeZoneName'
import { tzParseTimezone } from '../../_lib/tzParseTimezone'

@@ -144,2 +144,2 @@ var MILLISECONDS_IN_MINUTE = 60 * 1000

export default formatters
export { formatters }
import { format as dateFnsFormat } from 'date-fns/format'
import formatters from './formatters/index.js'
import toDate from '../toDate/index.js'
import { formatters } from './formatters'
import { toDate } from '../toDate'

@@ -319,3 +319,3 @@ var tzFormattingTokensRegExp = /([xXOz]+)|''|'(''|[^'])+('|$)/g

*/
export default function format(dirtyDate, dirtyFormatStr, dirtyOptions) {
export function format(dirtyDate, dirtyFormatStr, dirtyOptions) {
var formatStr = String(dirtyFormatStr)

@@ -330,10 +330,10 @@ var options = dirtyOptions || {}

formatStr = matches.reduce(function (result, token) {
if (token[0] === "'") {
if (token[0] === '\'') {
return result // This is a quoted portion, matched only to ensure we don't match inside it
}
var pos = result.indexOf(token)
var precededByQuotedSection = result[pos - 1] === "'"
var precededByQuotedSection = result[pos - 1] === '\''
var replaced = result.replace(
token,
"'" + formatters[token[0]](date, token, null, options) + "'"
'\'' + formatters[token[0]](date, token, null, options) + '\'',
)

@@ -340,0 +340,0 @@ // If the replacement results in two adjoining quoted strings, the back to back quotes

@@ -1,3 +0,3 @@

import format from '../format/index.js'
import utcToZonedTime from '../utcToZonedTime/index.js'
import { format } from '../format'
import { toZonedTime } from '../toZonedTime'
import cloneDeep from 'lodash.clonedeep'

@@ -27,7 +27,7 @@

*/
export default function formatInTimeZone(date, timeZone, formatStr, options) {
export function formatInTimeZone(date, timeZone, formatStr, options) {
var extendedOptions = cloneDeep(options || {})
extendedOptions.timeZone = timeZone
extendedOptions.originalDate = date
return format(utcToZonedTime(date, timeZone), formatStr, extendedOptions)
return format(toZonedTime(date, timeZone), formatStr, extendedOptions)
}
// This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.
import fn from '../../format/index.js'
import { format as fn } from '../../format'
import { convertToFP } from '../_lib/convertToFP'
var format = convertToFP(fn, 2)
export default format
export const format = convertToFP(fn, 2)
// This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.
import fn from '../../formatInTimeZone/index.js'
import { formatInTimeZone as fn } from '../../formatInTimeZone'
import { convertToFP } from '../_lib/convertToFP'
var formatInTimeZone = convertToFP(fn, 3)
export default formatInTimeZone
export const formatInTimeZone = convertToFP(fn, 3)
// This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.
import fn from '../../formatInTimeZone/index.js'
import { formatInTimeZone as fn } from '../../formatInTimeZone'
import { convertToFP } from '../_lib/convertToFP'
var formatInTimeZoneWithOptions = convertToFP(fn, 4)
export default formatInTimeZoneWithOptions
export const formatInTimeZoneWithOptions = convertToFP(fn, 4)
// This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.
import fn from '../../format/index.js'
import { format as fn } from '../../format'
import { convertToFP } from '../_lib/convertToFP'
var formatWithOptions = convertToFP(fn, 3)
export default formatWithOptions
export const formatWithOptions = convertToFP(fn, 3)
// This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.
import fn from '../../getTimezoneOffset/index.js'
import { getTimezoneOffset as fn } from '../../getTimezoneOffset'
import { convertToFP } from '../_lib/convertToFP'
var getTimezoneOffset = convertToFP(fn, 2)
export default getTimezoneOffset
export const getTimezoneOffset = convertToFP(fn, 2)
// This file is generated automatically by `scripts/build/indices.js`. Please, don't change it.
export { default as format } from './format/index.js'
export { default as formatInTimeZone } from './formatInTimeZone/index.js'
export { default as formatInTimeZoneWithOptions } from './formatInTimeZoneWithOptions/index.js'
export { default as formatWithOptions } from './formatWithOptions/index.js'
export { default as getTimezoneOffset } from './getTimezoneOffset/index.js'
export { default as toDate } from './toDate/index.js'
export { default as toDateWithOptions } from './toDateWithOptions/index.js'
export { default as utcToZonedTime } from './utcToZonedTime/index.js'
export { default as utcToZonedTimeWithOptions } from './utcToZonedTimeWithOptions/index.js'
export { default as zonedTimeToUtc } from './zonedTimeToUtc/index.js'
export { default as zonedTimeToUtcWithOptions } from './zonedTimeToUtcWithOptions/index.js'
export * from './format/index.js'
export * from './formatInTimeZone/index.js'
export * from './formatInTimeZoneWithOptions/index.js'
export * from './formatWithOptions/index.js'
export * from './fromZonedTime/index.js'
export * from './fromZonedTimeWithOptions/index.js'
export * from './getTimezoneOffset/index.js'
export * from './toDate/index.js'
export * from './toDateWithOptions/index.js'
export * from './toZonedTime/index.js'
export * from './toZonedTimeWithOptions/index.js'
// This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.
import fn from '../../toDate/index.js'
import { toDate as fn } from '../../toDate'
import { convertToFP } from '../_lib/convertToFP'
var toDate = convertToFP(fn, 1)
export default toDate
export const toDate = convertToFP(fn, 1)
// This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.
import fn from '../../toDate/index.js'
import { toDate as fn } from '../../toDate'
import { convertToFP } from '../_lib/convertToFP'
var toDateWithOptions = convertToFP(fn, 2)
export default toDateWithOptions
export const toDateWithOptions = convertToFP(fn, 2)

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

import tzParseTimezone from '../_lib/tzParseTimezone/index.js'
import { tzParseTimezone } from '../_lib/tzParseTimezone/index.js'

@@ -30,4 +30,4 @@ /**

*/
export default function getTimezoneOffset(timeZone, date) {
export function getTimezoneOffset(timeZone, date) {
return -tzParseTimezone(timeZone, date)
}
// This file is generated automatically by `scripts/build/indices.js`. Please, don't change it.
export { default as format } from './format/index.js'
export { default as formatInTimeZone } from './formatInTimeZone/index.js'
export { default as getTimezoneOffset } from './getTimezoneOffset/index.js'
export { default as toDate } from './toDate/index.js'
export { default as utcToZonedTime } from './utcToZonedTime/index.js'
export { default as zonedTimeToUtc } from './zonedTimeToUtc/index.js'
export * from './format/index.js'
export * from './formatInTimeZone/index.js'
export * from './fromZonedTime/index.js'
export * from './getTimezoneOffset/index.js'
export * from './toDate/index.js'
export * from './toZonedTime/index.js'

@@ -1,4 +0,4 @@

import { getTimezoneOffsetInMilliseconds } from '../_lib/getTimezoneOffsetInMilliseconds/index.js'
import tzParseTimezone from '../_lib/tzParseTimezone/index.js'
import tzPattern from '../_lib/tzPattern/index.js'
import { getTimezoneOffsetInMilliseconds } from '../_lib/getTimezoneOffsetInMilliseconds'
import { tzParseTimezone } from '../_lib/tzParseTimezone'
import { tzPattern } from '../_lib/tzPattern'

@@ -84,3 +84,3 @@ var MILLISECONDS_IN_HOUR = 3600000

*/
export default function toDate(argument, dirtyOptions) {
export function toDate(argument, dirtyOptions) {
if (arguments.length < 1) {

@@ -87,0 +87,0 @@ throw new TypeError('1 argument required, but only ' + arguments.length + ' present')

@@ -6,8 +6,7 @@ "use strict";

});
exports["default"] = void 0;
var _index = _interopRequireDefault(require("../../_lib/tzIntlTimeZoneName/index.js"));
var _index2 = _interopRequireDefault(require("../../_lib/tzParseTimezone/index.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
exports.formatters = void 0;
var _tzIntlTimeZoneName = require("../../_lib/tzIntlTimeZoneName");
var _tzParseTimezone = require("../../_lib/tzParseTimezone");
var MILLISECONDS_IN_MINUTE = 60 * 1000;
var formatters = {
var formatters = exports.formatters = {
// Timezone (ISO-8601. If offset is 0, output is always `'Z'`)

@@ -88,7 +87,7 @@ X: function X(date, token, localize, options) {

case 'zzz':
return (0, _index["default"])('short', date, options);
return (0, _tzIntlTimeZoneName.tzIntlTimeZoneName)('short', date, options);
// Long
case 'zzzz':
default:
return (0, _index["default"])('long', date, options);
return (0, _tzIntlTimeZoneName.tzIntlTimeZoneName)('long', date, options);
}

@@ -98,3 +97,3 @@ }

function getTimeZoneOffset(timeZone, originalDate) {
var timeZoneOffset = timeZone ? (0, _index2["default"])(timeZone, originalDate, true) / MILLISECONDS_IN_MINUTE : originalDate.getTimezoneOffset();
var timeZoneOffset = timeZone ? (0, _tzParseTimezone.tzParseTimezone)(timeZone, originalDate, true) / MILLISECONDS_IN_MINUTE : originalDate.getTimezoneOffset();
if (Number.isNaN(timeZoneOffset)) {

@@ -138,4 +137,2 @@ throw new RangeError('Invalid time zone specified: ' + timeZone);

return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
}
var _default = exports["default"] = formatters;
module.exports = exports.default;
}

@@ -6,7 +6,6 @@ "use strict";

});
exports["default"] = format;
exports.format = format;
var _format = require("date-fns/format");
var _index = _interopRequireDefault(require("./formatters/index.js"));
var _index2 = _interopRequireDefault(require("../toDate/index.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _formatters = require("./formatters");
var _toDate = require("../toDate");
var tzFormattingTokensRegExp = /([xXOz]+)|''|'(''|[^'])+('|$)/g;

@@ -331,12 +330,12 @@

if (matches) {
var date = (0, _index2["default"])(options.originalDate || dirtyDate, options);
var date = (0, _toDate.toDate)(options.originalDate || dirtyDate, options);
// Work through each match and replace the tz token in the format string with the quoted
// formatted time zone so the remaining tokens can be filled in by date-fns#format.
formatStr = matches.reduce(function (result, token) {
if (token[0] === "'") {
if (token[0] === '\'') {
return result; // This is a quoted portion, matched only to ensure we don't match inside it
}
var pos = result.indexOf(token);
var precededByQuotedSection = result[pos - 1] === "'";
var replaced = result.replace(token, "'" + _index["default"][token[0]](date, token, null, options) + "'");
var precededByQuotedSection = result[pos - 1] === '\'';
var replaced = result.replace(token, '\'' + _formatters.formatters[token[0]](date, token, null, options) + '\'');
// If the replacement results in two adjoining quoted strings, the back to back quotes

@@ -348,3 +347,2 @@ // are removed, so it doesn't look like an escaped quote.

return (0, _format.format)(dirtyDate, formatStr, options);
}
module.exports = exports.default;
}

@@ -6,5 +6,5 @@ "use strict";

});
exports["default"] = formatInTimeZone;
var _index = _interopRequireDefault(require("../format/index.js"));
var _index2 = _interopRequireDefault(require("../utcToZonedTime/index.js"));
exports.formatInTimeZone = formatInTimeZone;
var _format = require("../format");
var _toZonedTime = require("../toZonedTime");
var _lodash = _interopRequireDefault(require("lodash.clonedeep"));

@@ -38,4 +38,3 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

extendedOptions.originalDate = date;
return (0, _index["default"])((0, _index2["default"])(date, timeZone), formatStr, extendedOptions);
}
module.exports = exports.default;
return (0, _format.format)((0, _toZonedTime.toZonedTime)(date, timeZone), formatStr, extendedOptions);
}

@@ -6,10 +6,7 @@ "use strict";

});
exports["default"] = void 0;
var _index = _interopRequireDefault(require("../../format/index.js"));
exports.format = void 0;
var _format = require("../../format");
var _convertToFP = require("../_lib/convertToFP");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
// This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.
var format = (0, _convertToFP.convertToFP)(_index["default"], 2);
var _default = exports["default"] = format;
module.exports = exports.default;
var format = exports.format = (0, _convertToFP.convertToFP)(_format.format, 2);

@@ -6,10 +6,7 @@ "use strict";

});
exports["default"] = void 0;
var _index = _interopRequireDefault(require("../../formatInTimeZone/index.js"));
exports.formatInTimeZone = void 0;
var _formatInTimeZone = require("../../formatInTimeZone");
var _convertToFP = require("../_lib/convertToFP");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
// This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.
var formatInTimeZone = (0, _convertToFP.convertToFP)(_index["default"], 3);
var _default = exports["default"] = formatInTimeZone;
module.exports = exports.default;
var formatInTimeZone = exports.formatInTimeZone = (0, _convertToFP.convertToFP)(_formatInTimeZone.formatInTimeZone, 3);

@@ -6,10 +6,7 @@ "use strict";

});
exports["default"] = void 0;
var _index = _interopRequireDefault(require("../../formatInTimeZone/index.js"));
exports.formatInTimeZoneWithOptions = void 0;
var _formatInTimeZone = require("../../formatInTimeZone");
var _convertToFP = require("../_lib/convertToFP");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
// This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.
var formatInTimeZoneWithOptions = (0, _convertToFP.convertToFP)(_index["default"], 4);
var _default = exports["default"] = formatInTimeZoneWithOptions;
module.exports = exports.default;
var formatInTimeZoneWithOptions = exports.formatInTimeZoneWithOptions = (0, _convertToFP.convertToFP)(_formatInTimeZone.formatInTimeZone, 4);

@@ -6,10 +6,7 @@ "use strict";

});
exports["default"] = void 0;
var _index = _interopRequireDefault(require("../../format/index.js"));
exports.formatWithOptions = void 0;
var _format = require("../../format");
var _convertToFP = require("../_lib/convertToFP");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
// This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.
var formatWithOptions = (0, _convertToFP.convertToFP)(_index["default"], 3);
var _default = exports["default"] = formatWithOptions;
module.exports = exports.default;
var formatWithOptions = exports.formatWithOptions = (0, _convertToFP.convertToFP)(_format.format, 3);

@@ -6,10 +6,7 @@ "use strict";

});
exports["default"] = void 0;
var _index = _interopRequireDefault(require("../../getTimezoneOffset/index.js"));
exports.getTimezoneOffset = void 0;
var _getTimezoneOffset = require("../../getTimezoneOffset");
var _convertToFP = require("../_lib/convertToFP");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
// This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.
var getTimezoneOffset = (0, _convertToFP.convertToFP)(_index["default"], 2);
var _default = exports["default"] = getTimezoneOffset;
module.exports = exports.default;
var getTimezoneOffset = exports.getTimezoneOffset = (0, _convertToFP.convertToFP)(_getTimezoneOffset.getTimezoneOffset, 2);

@@ -6,13 +6,13 @@ "use strict";

module.exports = {
format: require('./format/index.js'),
formatInTimeZone: require('./formatInTimeZone/index.js'),
formatInTimeZoneWithOptions: require('./formatInTimeZoneWithOptions/index.js'),
formatWithOptions: require('./formatWithOptions/index.js'),
getTimezoneOffset: require('./getTimezoneOffset/index.js'),
toDate: require('./toDate/index.js'),
toDateWithOptions: require('./toDateWithOptions/index.js'),
utcToZonedTime: require('./utcToZonedTime/index.js'),
utcToZonedTimeWithOptions: require('./utcToZonedTimeWithOptions/index.js'),
zonedTimeToUtc: require('./zonedTimeToUtc/index.js'),
zonedTimeToUtcWithOptions: require('./zonedTimeToUtcWithOptions/index.js')
format: require('./format/index.js').format,
formatInTimeZone: require('./formatInTimeZone/index.js').formatInTimeZone,
formatInTimeZoneWithOptions: require('./formatInTimeZoneWithOptions/index.js').formatInTimeZoneWithOptions,
formatWithOptions: require('./formatWithOptions/index.js').formatWithOptions,
fromZonedTime: require('./fromZonedTime/index.js').fromZonedTime,
fromZonedTimeWithOptions: require('./fromZonedTimeWithOptions/index.js').fromZonedTimeWithOptions,
getTimezoneOffset: require('./getTimezoneOffset/index.js').getTimezoneOffset,
toDate: require('./toDate/index.js').toDate,
toDateWithOptions: require('./toDateWithOptions/index.js').toDateWithOptions,
toZonedTime: require('./toZonedTime/index.js').toZonedTime,
toZonedTimeWithOptions: require('./toZonedTimeWithOptions/index.js').toZonedTimeWithOptions
};

@@ -6,10 +6,7 @@ "use strict";

});
exports["default"] = void 0;
var _index = _interopRequireDefault(require("../../toDate/index.js"));
exports.toDate = void 0;
var _toDate = require("../../toDate");
var _convertToFP = require("../_lib/convertToFP");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
// This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.
var toDate = (0, _convertToFP.convertToFP)(_index["default"], 1);
var _default = exports["default"] = toDate;
module.exports = exports.default;
var toDate = exports.toDate = (0, _convertToFP.convertToFP)(_toDate.toDate, 1);

@@ -6,10 +6,7 @@ "use strict";

});
exports["default"] = void 0;
var _index = _interopRequireDefault(require("../../toDate/index.js"));
exports.toDateWithOptions = void 0;
var _toDate = require("../../toDate");
var _convertToFP = require("../_lib/convertToFP");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
// This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.
var toDateWithOptions = (0, _convertToFP.convertToFP)(_index["default"], 2);
var _default = exports["default"] = toDateWithOptions;
module.exports = exports.default;
var toDateWithOptions = exports.toDateWithOptions = (0, _convertToFP.convertToFP)(_toDate.toDate, 2);

@@ -6,5 +6,4 @@ "use strict";

});
exports["default"] = getTimezoneOffset;
var _index = _interopRequireDefault(require("../_lib/tzParseTimezone/index.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
exports.getTimezoneOffset = getTimezoneOffset;
var _index = require("../_lib/tzParseTimezone/index.js");
/**

@@ -38,4 +37,3 @@ * @name getTimezoneOffset

function getTimezoneOffset(timeZone, date) {
return -(0, _index["default"])(timeZone, date);
}
module.exports = exports.default;
return -(0, _index.tzParseTimezone)(timeZone, date);
}

@@ -6,8 +6,8 @@ "use strict";

module.exports = {
format: require('./format/index.js'),
formatInTimeZone: require('./formatInTimeZone/index.js'),
getTimezoneOffset: require('./getTimezoneOffset/index.js'),
toDate: require('./toDate/index.js'),
utcToZonedTime: require('./utcToZonedTime/index.js'),
zonedTimeToUtc: require('./zonedTimeToUtc/index.js')
format: require('./format/index.js').format,
formatInTimeZone: require('./formatInTimeZone/index.js').formatInTimeZone,
fromZonedTime: require('./fromZonedTime/index.js').fromZonedTime,
getTimezoneOffset: require('./getTimezoneOffset/index.js').getTimezoneOffset,
toDate: require('./toDate/index.js').toDate,
toZonedTime: require('./toZonedTime/index.js').toZonedTime
};
{
"name": "date-fns-tz",
"version": "3.0.0-beta.3",
"version": "3.0.0-beta.4",
"sideEffects": false,

@@ -53,11 +53,11 @@ "description": "Time zone support for date-fns v3 with the Intl API",

},
"./utcToZonedTime": {
"types": "./utcToZonedTime/index.d.ts",
"import": "./esm/utcToZonedTime/index.js",
"require": "./utcToZonedTime/index.js"
"./toZonedTime": {
"types": "./toZonedTime/index.d.ts",
"import": "./esm/toZonedTime/index.js",
"require": "./toZonedTime/index.js"
},
"./zonedTimeToUtc": {
"types": "./zonedTimeToUtc/index.d.ts",
"import": "./esm/zonedTimeToUtc/index.js",
"require": "./zonedTimeToUtc/index.js"
"./fromZonedTime": {
"types": "./fromZonedTime/index.d.ts",
"import": "./esm/fromZonedTime/index.js",
"require": "./fromZonedTime/index.js"
},

@@ -79,2 +79,22 @@ "./fp": {

},
"./fp/formatInTimeZoneWithOptions": {
"types": "./fp/formatInTimeZoneWithOptions/index.d.ts",
"import": "./esm/fp/formatInTimeZoneWithOptions/index.js",
"require": "./fp/formatInTimeZoneWithOptions/index.js"
},
"./fp/formatWithOptions": {
"types": "./fp/formatWithOptions/index.d.ts",
"import": "./esm/fp/formatWithOptions/index.js",
"require": "./fp/formatWithOptions/index.js"
},
"./fp/fromZonedTime": {
"types": "./fp/fromZonedTime/index.d.ts",
"import": "./esm/fp/fromZonedTime/index.js",
"require": "./fp/fromZonedTime/index.js"
},
"./fp/fromZonedTimeWithOptions": {
"types": "./fp/fromZonedTimeWithOptions/index.d.ts",
"import": "./esm/fp/fromZonedTimeWithOptions/index.js",
"require": "./fp/fromZonedTimeWithOptions/index.js"
},
"./fp/getTimezoneOffset": {

@@ -90,11 +110,16 @@ "types": "./fp/getTimezoneOffset/index.d.ts",

},
"./fp/utcToZonedTime": {
"types": "./fp/utcToZonedTime/index.d.ts",
"import": "./esm/fp/utcToZonedTime/index.js",
"require": "./fp/utcToZonedTime/index.js"
"./fp/toDateWithOptions": {
"types": "./fp/toDateWithOptions/index.d.ts",
"import": "./esm/fp/toDateWithOptions/index.js",
"require": "./fp/toDateWithOptions/index.js"
},
"./fp/zonedTimeToUtc": {
"types": "./fp/zonedTimeToUtc/index.d.ts",
"import": "./esm/fp/zonedTimeToUtc/index.js",
"require": "./fp/zonedTimeToUtc/index.js"
"./fp/toZonedTime": {
"types": "./fp/toZonedTime/index.d.ts",
"import": "./esm/fp/toZonedTime/index.js",
"require": "./fp/toZonedTime/index.js"
},
"./fp/toZonedTimeWithOptions": {
"types": "./fp/toZonedTimeWithOptions/index.d.ts",
"import": "./esm/fp/toZonedTimeWithOptions/index.js",
"require": "./fp/toZonedTimeWithOptions/index.js"
}

@@ -146,3 +171,2 @@ },

"eslint-config-prettier": "^7.2.0",
"flow-bin": "^0.143.1",
"fs-promise": "^2.0.3",

@@ -149,0 +173,0 @@ "husky": "^4.3.0",

@@ -37,4 +37,4 @@ # date-fns-tz

- [Time zone offset helpers](#time-zone-offset-helpers)
- [`zonedTimeToUtc`](#zonedtimetoutc) - Given a date and any time zone, returns a `Date` with the equivalent UTC time
- [`utcToZonedTime`](#utctozonedtime) - Get a date/time representing local time in a given time zone from the UTC date
- [`fromZonedTime`](#zonedtimetoutc) - Given a date and any time zone, returns a `Date` with the equivalent UTC time
- [`toZonedTime`](#utctozonedtime) - Get a date/time representing local time in a given time zone from the UTC date
- [`getTimezoneOffset`](#gettimezoneoffset) - Gets the offset in milliseconds between the time zone and UTC time

@@ -115,9 +115,10 @@ - [Low-level formatting helpers](#low-level-formatting-helpers)

### `zonedTimeToUtc`
### `fromZonedTime`
Given a date and any time zone, returns a `Date` with the equivalent UTC time.
An invalid date string or time zone will result in an `Invalid Date`.
Given a date and any time zone, returns the equivalent `Date` in the current system time zone
and the equivalent UTC time internally. An invalid date string or time zone will result in
an `Invalid Date`.
```ts
zonedTimeToUtc(date: Date|Number|String, timeZone: String): Date
fromZonedTime(date: Date|Number|String, timeZone: String): Date
```

@@ -132,3 +133,3 @@

```javascript
import { zonedTimeToUtc } from 'date-fns-tz'
import { fromZonedTime } from 'date-fns-tz'

@@ -138,3 +139,3 @@ const date = getDatePickerValue() // e.g. 2014-06-25 10:00:00 (picked in any time zone)

const utcDate = zonedTimeToUtc(date, timeZone) // In June 10am in Los Angeles is 5pm UTC
const utcDate = fromZonedTime(date, timeZone) // In June 10am in Los Angeles is 5pm UTC

@@ -144,9 +145,10 @@ postToServer(utcDate.toISOString(), timeZone) // post 2014-06-25T17:00:00.000Z, America/Los_Angeles

### `utcToZonedTime`
### `toZonedTime`
Returns a `Date` which will format as the local time of any time zone from a specific UTC time.
An invalid date string or time zone will result in an `Invalid Date`.
Returns a `Date` which will format as the local time of any time zone from a specific UTC time
or date in the current system time zone. An invalid date string or time zone will result in
an `Invalid Date`.
```js
utcToZonedTime(date: Date|Number|String, timeZone: String): Date
toZonedTime(date: Date|Number|String, timeZone: String): Date
```

@@ -159,7 +161,7 @@

```javascript
import { utcToZonedTime } from 'date-fns-tz'
import { toZonedTime } from 'date-fns-tz'
const { isoDate, timeZone } = fetchInitialValues() // 2014-06-25T10:00:00.000Z, America/New_York
const date = utcToZonedTime(isoDate, timeZone) // In June 10am UTC is 6am in New York (-04:00)
const date = toZonedTime(isoDate, timeZone) // In June 10am UTC is 6am in New York (-04:00)

@@ -225,3 +227,3 @@ renderDatePicker(date) // 2014-06-25 06:00:00 (in the system time zone)

To format a date showing time for a specific time zone other than the system time zone, the
`format` function can be combined with `utcToZonedTime`. This is what `formatInTimeZone` does
`format` function can be combined with `toZonedTime`. This is what `formatInTimeZone` does
internally. _To clarify, the `format` function will never change the underlying date, it must be

@@ -231,12 +233,12 @@ changed to a zoned time before passing it to `format`._

In most cases there is no need to use `format` rather than `formatInTimeZone`. The only time
this makes sense is when `utcToZonedTime` has been applied to a date once, and you want to
this makes sense is when `toZonedTime` has been applied to a date once, and you want to
format it multiple times to different outputs.
```javascript
import { format, utcToZonedTime } from 'date-fns-tz'
import { format, toZonedTime } from 'date-fns-tz'
const date = new Date('2014-10-25T10:46:20Z')
const nyDate = utcToZonedTime(date, 'America/New_York')
const parisDate = utcToZonedTime(date, 'Europe/Paris')
const nyDate = toZonedTime(date, 'America/New_York')
const parisDate = toZonedTime(date, 'Europe/Paris')

@@ -274,3 +276,3 @@ format(nyDate, 'yyyy-MM-dd HH:mm:ssXXX', { timeZone: 'America/New_York' }) // 2014-10-25 06:46:20-04:00

const parsedDate = toDate('2014-10-25T13:46:20+04:00')
const parisDate = utcToZonedTime(parsedDate, 'Europe/Paris')
const parisDate = toZonedTime(parsedDate, 'Europe/Paris')
format(parisDate, 'yyyy-MM-dd HH:mm:ssxxx', { timeZone: 'Europe/Paris' }) // 2014-10-25 11:46:20+02:00

@@ -285,3 +287,3 @@

const parsedDate = toDate('2014-10-25T13:46:20', { timeZone: 'Asia/Bangkok' })
const bangkokDate = utcToZonedTime(parsedDate, 'Asia/Bangkok')
const bangkokDate = toZonedTime(parsedDate, 'Asia/Bangkok')
format(bangkokDate, 'yyyy-MM-dd HH:mm:ssxxx', { timeZone: 'Asia/Bangkok' }) // 2014-10-25 13:46:20+07:00

@@ -292,5 +294,6 @@ ```

This library works with React Native, however the `Intl` API is not available by default on Android.
This library works with React Native on iOS, and on Android with Hermes which supports
`Intl` by default.
In projects that do not use Hermes, make this change to `android/app/build.gradle`:
In Android projects that do not use Hermes, make this change in `android/app/build.gradle`:

@@ -302,14 +305,7 @@ ```diff

React Native does not currently support `Intl` on Android with
Hermes ([facebook/hermes#23](https://github.com/facebook/hermes/issues/23)). The best bet
seems to be using the [polyfills by Format.JS](https://formatjs.io/docs/polyfills/intl-datetimeformat).
## Usage with Node.js
Node.js supports the `Intl` API and ships with full ICU data included in the binary from v13,
i.e. this library will just work.
Node.js supports the `Intl` API and ships with full ICU data included in the binary since v13,
so this library works by default.
Node.js v12, which reaches end of life on 30 April 2022, requires running with
[full ICU data provided at runtime](https://nodejs.org/docs/latest-v12.x/api/intl.html#intl_providing_icu_data_at_runtime).
## Credit

@@ -316,0 +312,0 @@

@@ -6,7 +6,6 @@ "use strict";

});
exports["default"] = toDate;
var _index = require("../_lib/getTimezoneOffsetInMilliseconds/index.js");
var _index2 = _interopRequireDefault(require("../_lib/tzParseTimezone/index.js"));
var _index3 = _interopRequireDefault(require("../_lib/tzPattern/index.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
exports.toDate = toDate;
var _getTimezoneOffsetInMilliseconds = require("../_lib/getTimezoneOffsetInMilliseconds");
var _tzParseTimezone = require("../_lib/tzParseTimezone");
var _tzPattern = require("../_lib/tzPattern");
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }

@@ -45,3 +44,3 @@ var MILLISECONDS_IN_HOUR = 3600000;

// time zone tokens (to identify the presence of a tz)
timeZone: _index3["default"]
timeZone: _tzPattern.tzPattern
};

@@ -131,3 +130,3 @@

if (dateStrings.timeZone || options.timeZone) {
offset = (0, _index2["default"])(dateStrings.timeZone || options.timeZone, new Date(timestamp + time));
offset = (0, _tzParseTimezone.tzParseTimezone)(dateStrings.timeZone || options.timeZone, new Date(timestamp + time));
if (isNaN(offset)) {

@@ -138,4 +137,4 @@ return new Date(NaN);

// get offset accurate to hour in time zones that change offset
offset = (0, _index.getTimezoneOffsetInMilliseconds)(new Date(timestamp + time));
offset = (0, _index.getTimezoneOffsetInMilliseconds)(new Date(timestamp + time + offset));
offset = (0, _getTimezoneOffsetInMilliseconds.getTimezoneOffsetInMilliseconds)(new Date(timestamp + time));
offset = (0, _getTimezoneOffsetInMilliseconds.getTimezoneOffsetInMilliseconds)(new Date(timestamp + time + offset));
}

@@ -393,3 +392,2 @@ return new Date(timestamp + time + offset);

return true;
}
module.exports = exports.default;
}

@@ -61,2 +61,9 @@ // This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.

function fromZonedTime(
date: Date | string | number,
timeZone: string,
options?: OptionsWithTZ
): Date
namespace fromZonedTime {}
function getTimezoneOffset(timeZone: string, date?: Date | number): number

@@ -68,3 +75,3 @@ namespace getTimezoneOffset {}

function utcToZonedTime(
function toZonedTime(
date: Date | string | number,

@@ -74,10 +81,3 @@ timeZone: string,

): Date
namespace utcToZonedTime {}
function zonedTimeToUtc(
date: Date | string | number,
timeZone: string,
options?: OptionsWithTZ
): Date
namespace zonedTimeToUtc {}
namespace toZonedTime {}
}

@@ -95,2 +95,7 @@

declare module 'date-fns-tz/fromZonedTime' {
import { fromZonedTime } from 'date-fns-tz'
export = fromZonedTime
}
declare module 'date-fns-tz/getTimezoneOffset' {

@@ -106,12 +111,7 @@ import { getTimezoneOffset } from 'date-fns-tz'

declare module 'date-fns-tz/utcToZonedTime' {
import { utcToZonedTime } from 'date-fns-tz'
export = utcToZonedTime
declare module 'date-fns-tz/toZonedTime' {
import { toZonedTime } from 'date-fns-tz'
export = toZonedTime
}
declare module 'date-fns-tz/zonedTimeToUtc' {
import { zonedTimeToUtc } from 'date-fns-tz'
export = zonedTimeToUtc
}
declare module 'date-fns-tz/format/index' {

@@ -127,2 +127,7 @@ import { format } from 'date-fns-tz'

declare module 'date-fns-tz/fromZonedTime/index' {
import { fromZonedTime } from 'date-fns-tz'
export = fromZonedTime
}
declare module 'date-fns-tz/getTimezoneOffset/index' {

@@ -138,12 +143,7 @@ import { getTimezoneOffset } from 'date-fns-tz'

declare module 'date-fns-tz/utcToZonedTime/index' {
import { utcToZonedTime } from 'date-fns-tz'
export = utcToZonedTime
declare module 'date-fns-tz/toZonedTime/index' {
import { toZonedTime } from 'date-fns-tz'
export = toZonedTime
}
declare module 'date-fns-tz/zonedTimeToUtc/index' {
import { zonedTimeToUtc } from 'date-fns-tz'
export = zonedTimeToUtc
}
declare module 'date-fns-tz/format/index.js' {

@@ -159,2 +159,7 @@ import { format } from 'date-fns-tz'

declare module 'date-fns-tz/fromZonedTime/index.js' {
import { fromZonedTime } from 'date-fns-tz'
export = fromZonedTime
}
declare module 'date-fns-tz/getTimezoneOffset/index.js' {

@@ -170,12 +175,7 @@ import { getTimezoneOffset } from 'date-fns-tz'

declare module 'date-fns-tz/utcToZonedTime/index.js' {
import { utcToZonedTime } from 'date-fns-tz'
export = utcToZonedTime
declare module 'date-fns-tz/toZonedTime/index.js' {
import { toZonedTime } from 'date-fns-tz'
export = toZonedTime
}
declare module 'date-fns-tz/zonedTimeToUtc/index.js' {
import { zonedTimeToUtc } from 'date-fns-tz'
export = zonedTimeToUtc
}
// FP Functions

@@ -204,2 +204,8 @@

const fromZonedTime: CurriedFn2<string, Date | string | number, Date>
namespace fromZonedTime {}
const fromZonedTimeWithOptions: CurriedFn3<OptionsWithTZ, string, Date | string | number, Date>
namespace fromZonedTimeWithOptions {}
const getTimezoneOffset: CurriedFn2<Date | number, string, number>

@@ -214,13 +220,7 @@ namespace getTimezoneOffset {}

const utcToZonedTime: CurriedFn2<string, Date | string | number, Date>
namespace utcToZonedTime {}
const toZonedTime: CurriedFn2<string, Date | string | number, Date>
namespace toZonedTime {}
const utcToZonedTimeWithOptions: CurriedFn3<OptionsWithTZ, string, Date | string | number, Date>
namespace utcToZonedTimeWithOptions {}
const zonedTimeToUtc: CurriedFn2<string, Date | string | number, Date>
namespace zonedTimeToUtc {}
const zonedTimeToUtcWithOptions: CurriedFn3<OptionsWithTZ, string, Date | string | number, Date>
namespace zonedTimeToUtcWithOptions {}
const toZonedTimeWithOptions: CurriedFn3<OptionsWithTZ, string, Date | string | number, Date>
namespace toZonedTimeWithOptions {}
}

@@ -248,2 +248,12 @@

declare module 'date-fns-tz/fp/fromZonedTime' {
import { fromZonedTime } from 'date-fns-tz/fp'
export = fromZonedTime
}
declare module 'date-fns-tz/fp/fromZonedTimeWithOptions' {
import { fromZonedTimeWithOptions } from 'date-fns-tz/fp'
export = fromZonedTimeWithOptions
}
declare module 'date-fns-tz/fp/getTimezoneOffset' {

@@ -264,22 +274,12 @@ import { getTimezoneOffset } from 'date-fns-tz/fp'

declare module 'date-fns-tz/fp/utcToZonedTime' {
import { utcToZonedTime } from 'date-fns-tz/fp'
export = utcToZonedTime
declare module 'date-fns-tz/fp/toZonedTime' {
import { toZonedTime } from 'date-fns-tz/fp'
export = toZonedTime
}
declare module 'date-fns-tz/fp/utcToZonedTimeWithOptions' {
import { utcToZonedTimeWithOptions } from 'date-fns-tz/fp'
export = utcToZonedTimeWithOptions
declare module 'date-fns-tz/fp/toZonedTimeWithOptions' {
import { toZonedTimeWithOptions } from 'date-fns-tz/fp'
export = toZonedTimeWithOptions
}
declare module 'date-fns-tz/fp/zonedTimeToUtc' {
import { zonedTimeToUtc } from 'date-fns-tz/fp'
export = zonedTimeToUtc
}
declare module 'date-fns-tz/fp/zonedTimeToUtcWithOptions' {
import { zonedTimeToUtcWithOptions } from 'date-fns-tz/fp'
export = zonedTimeToUtcWithOptions
}
declare module 'date-fns-tz/fp/format/index' {

@@ -305,2 +305,12 @@ import { format } from 'date-fns-tz/fp'

declare module 'date-fns-tz/fp/fromZonedTime/index' {
import { fromZonedTime } from 'date-fns-tz/fp'
export = fromZonedTime
}
declare module 'date-fns-tz/fp/fromZonedTimeWithOptions/index' {
import { fromZonedTimeWithOptions } from 'date-fns-tz/fp'
export = fromZonedTimeWithOptions
}
declare module 'date-fns-tz/fp/getTimezoneOffset/index' {

@@ -321,22 +331,12 @@ import { getTimezoneOffset } from 'date-fns-tz/fp'

declare module 'date-fns-tz/fp/utcToZonedTime/index' {
import { utcToZonedTime } from 'date-fns-tz/fp'
export = utcToZonedTime
declare module 'date-fns-tz/fp/toZonedTime/index' {
import { toZonedTime } from 'date-fns-tz/fp'
export = toZonedTime
}
declare module 'date-fns-tz/fp/utcToZonedTimeWithOptions/index' {
import { utcToZonedTimeWithOptions } from 'date-fns-tz/fp'
export = utcToZonedTimeWithOptions
declare module 'date-fns-tz/fp/toZonedTimeWithOptions/index' {
import { toZonedTimeWithOptions } from 'date-fns-tz/fp'
export = toZonedTimeWithOptions
}
declare module 'date-fns-tz/fp/zonedTimeToUtc/index' {
import { zonedTimeToUtc } from 'date-fns-tz/fp'
export = zonedTimeToUtc
}
declare module 'date-fns-tz/fp/zonedTimeToUtcWithOptions/index' {
import { zonedTimeToUtcWithOptions } from 'date-fns-tz/fp'
export = zonedTimeToUtcWithOptions
}
declare module 'date-fns-tz/fp/format/index.js' {

@@ -362,2 +362,12 @@ import { format } from 'date-fns-tz/fp'

declare module 'date-fns-tz/fp/fromZonedTime/index.js' {
import { fromZonedTime } from 'date-fns-tz/fp'
export = fromZonedTime
}
declare module 'date-fns-tz/fp/fromZonedTimeWithOptions/index.js' {
import { fromZonedTimeWithOptions } from 'date-fns-tz/fp'
export = fromZonedTimeWithOptions
}
declare module 'date-fns-tz/fp/getTimezoneOffset/index.js' {

@@ -378,22 +388,12 @@ import { getTimezoneOffset } from 'date-fns-tz/fp'

declare module 'date-fns-tz/fp/utcToZonedTime/index.js' {
import { utcToZonedTime } from 'date-fns-tz/fp'
export = utcToZonedTime
declare module 'date-fns-tz/fp/toZonedTime/index.js' {
import { toZonedTime } from 'date-fns-tz/fp'
export = toZonedTime
}
declare module 'date-fns-tz/fp/utcToZonedTimeWithOptions/index.js' {
import { utcToZonedTimeWithOptions } from 'date-fns-tz/fp'
export = utcToZonedTimeWithOptions
declare module 'date-fns-tz/fp/toZonedTimeWithOptions/index.js' {
import { toZonedTimeWithOptions } from 'date-fns-tz/fp'
export = toZonedTimeWithOptions
}
declare module 'date-fns-tz/fp/zonedTimeToUtc/index.js' {
import { zonedTimeToUtc } from 'date-fns-tz/fp'
export = zonedTimeToUtc
}
declare module 'date-fns-tz/fp/zonedTimeToUtcWithOptions/index.js' {
import { zonedTimeToUtcWithOptions } from 'date-fns-tz/fp'
export = zonedTimeToUtcWithOptions
}
// ECMAScript Module Functions

@@ -415,2 +415,9 @@

function fromZonedTime(
date: Date | string | number,
timeZone: string,
options?: OptionsWithTZ
): Date
namespace fromZonedTime {}
function getTimezoneOffset(timeZone: string, date?: Date | number): number

@@ -422,3 +429,3 @@ namespace getTimezoneOffset {}

function utcToZonedTime(
function toZonedTime(
date: Date | string | number,

@@ -428,10 +435,3 @@ timeZone: string,

): Date
namespace utcToZonedTime {}
function zonedTimeToUtc(
date: Date | string | number,
timeZone: string,
options?: OptionsWithTZ
): Date
namespace zonedTimeToUtc {}
namespace toZonedTime {}
}

@@ -449,2 +449,7 @@

declare module 'date-fns-tz/esm/fromZonedTime' {
import { fromZonedTime } from 'date-fns-tz/esm'
export default fromZonedTime
}
declare module 'date-fns-tz/esm/getTimezoneOffset' {

@@ -460,12 +465,7 @@ import { getTimezoneOffset } from 'date-fns-tz/esm'

declare module 'date-fns-tz/esm/utcToZonedTime' {
import { utcToZonedTime } from 'date-fns-tz/esm'
export default utcToZonedTime
declare module 'date-fns-tz/esm/toZonedTime' {
import { toZonedTime } from 'date-fns-tz/esm'
export default toZonedTime
}
declare module 'date-fns-tz/esm/zonedTimeToUtc' {
import { zonedTimeToUtc } from 'date-fns-tz/esm'
export default zonedTimeToUtc
}
declare module 'date-fns-tz/esm/format/index' {

@@ -481,2 +481,7 @@ import { format } from 'date-fns-tz/esm'

declare module 'date-fns-tz/esm/fromZonedTime/index' {
import { fromZonedTime } from 'date-fns-tz/esm'
export default fromZonedTime
}
declare module 'date-fns-tz/esm/getTimezoneOffset/index' {

@@ -492,12 +497,7 @@ import { getTimezoneOffset } from 'date-fns-tz/esm'

declare module 'date-fns-tz/esm/utcToZonedTime/index' {
import { utcToZonedTime } from 'date-fns-tz/esm'
export default utcToZonedTime
declare module 'date-fns-tz/esm/toZonedTime/index' {
import { toZonedTime } from 'date-fns-tz/esm'
export default toZonedTime
}
declare module 'date-fns-tz/esm/zonedTimeToUtc/index' {
import { zonedTimeToUtc } from 'date-fns-tz/esm'
export default zonedTimeToUtc
}
declare module 'date-fns-tz/esm/format/index.js' {

@@ -513,2 +513,7 @@ import { format } from 'date-fns-tz/esm'

declare module 'date-fns-tz/esm/fromZonedTime/index.js' {
import { fromZonedTime } from 'date-fns-tz/esm'
export default fromZonedTime
}
declare module 'date-fns-tz/esm/getTimezoneOffset/index.js' {

@@ -524,12 +529,7 @@ import { getTimezoneOffset } from 'date-fns-tz/esm'

declare module 'date-fns-tz/esm/utcToZonedTime/index.js' {
import { utcToZonedTime } from 'date-fns-tz/esm'
export default utcToZonedTime
declare module 'date-fns-tz/esm/toZonedTime/index.js' {
import { toZonedTime } from 'date-fns-tz/esm'
export default toZonedTime
}
declare module 'date-fns-tz/esm/zonedTimeToUtc/index.js' {
import { zonedTimeToUtc } from 'date-fns-tz/esm'
export default zonedTimeToUtc
}
// ECMAScript Module FP Functions

@@ -558,2 +558,8 @@

const fromZonedTime: CurriedFn2<string, Date | string | number, Date>
namespace fromZonedTime {}
const fromZonedTimeWithOptions: CurriedFn3<OptionsWithTZ, string, Date | string | number, Date>
namespace fromZonedTimeWithOptions {}
const getTimezoneOffset: CurriedFn2<Date | number, string, number>

@@ -568,13 +574,7 @@ namespace getTimezoneOffset {}

const utcToZonedTime: CurriedFn2<string, Date | string | number, Date>
namespace utcToZonedTime {}
const toZonedTime: CurriedFn2<string, Date | string | number, Date>
namespace toZonedTime {}
const utcToZonedTimeWithOptions: CurriedFn3<OptionsWithTZ, string, Date | string | number, Date>
namespace utcToZonedTimeWithOptions {}
const zonedTimeToUtc: CurriedFn2<string, Date | string | number, Date>
namespace zonedTimeToUtc {}
const zonedTimeToUtcWithOptions: CurriedFn3<OptionsWithTZ, string, Date | string | number, Date>
namespace zonedTimeToUtcWithOptions {}
const toZonedTimeWithOptions: CurriedFn3<OptionsWithTZ, string, Date | string | number, Date>
namespace toZonedTimeWithOptions {}
}

@@ -602,2 +602,12 @@

declare module 'date-fns-tz/esm/fp/fromZonedTime' {
import { fromZonedTime } from 'date-fns-tz/esm/fp'
export default fromZonedTime
}
declare module 'date-fns-tz/esm/fp/fromZonedTimeWithOptions' {
import { fromZonedTimeWithOptions } from 'date-fns-tz/esm/fp'
export default fromZonedTimeWithOptions
}
declare module 'date-fns-tz/esm/fp/getTimezoneOffset' {

@@ -618,22 +628,12 @@ import { getTimezoneOffset } from 'date-fns-tz/esm/fp'

declare module 'date-fns-tz/esm/fp/utcToZonedTime' {
import { utcToZonedTime } from 'date-fns-tz/esm/fp'
export default utcToZonedTime
declare module 'date-fns-tz/esm/fp/toZonedTime' {
import { toZonedTime } from 'date-fns-tz/esm/fp'
export default toZonedTime
}
declare module 'date-fns-tz/esm/fp/utcToZonedTimeWithOptions' {
import { utcToZonedTimeWithOptions } from 'date-fns-tz/esm/fp'
export default utcToZonedTimeWithOptions
declare module 'date-fns-tz/esm/fp/toZonedTimeWithOptions' {
import { toZonedTimeWithOptions } from 'date-fns-tz/esm/fp'
export default toZonedTimeWithOptions
}
declare module 'date-fns-tz/esm/fp/zonedTimeToUtc' {
import { zonedTimeToUtc } from 'date-fns-tz/esm/fp'
export default zonedTimeToUtc
}
declare module 'date-fns-tz/esm/fp/zonedTimeToUtcWithOptions' {
import { zonedTimeToUtcWithOptions } from 'date-fns-tz/esm/fp'
export default zonedTimeToUtcWithOptions
}
declare module 'date-fns-tz/esm/fp/format/index' {

@@ -659,2 +659,12 @@ import { format } from 'date-fns-tz/esm/fp'

declare module 'date-fns-tz/esm/fp/fromZonedTime/index' {
import { fromZonedTime } from 'date-fns-tz/esm/fp'
export default fromZonedTime
}
declare module 'date-fns-tz/esm/fp/fromZonedTimeWithOptions/index' {
import { fromZonedTimeWithOptions } from 'date-fns-tz/esm/fp'
export default fromZonedTimeWithOptions
}
declare module 'date-fns-tz/esm/fp/getTimezoneOffset/index' {

@@ -675,22 +685,12 @@ import { getTimezoneOffset } from 'date-fns-tz/esm/fp'

declare module 'date-fns-tz/esm/fp/utcToZonedTime/index' {
import { utcToZonedTime } from 'date-fns-tz/esm/fp'
export default utcToZonedTime
declare module 'date-fns-tz/esm/fp/toZonedTime/index' {
import { toZonedTime } from 'date-fns-tz/esm/fp'
export default toZonedTime
}
declare module 'date-fns-tz/esm/fp/utcToZonedTimeWithOptions/index' {
import { utcToZonedTimeWithOptions } from 'date-fns-tz/esm/fp'
export default utcToZonedTimeWithOptions
declare module 'date-fns-tz/esm/fp/toZonedTimeWithOptions/index' {
import { toZonedTimeWithOptions } from 'date-fns-tz/esm/fp'
export default toZonedTimeWithOptions
}
declare module 'date-fns-tz/esm/fp/zonedTimeToUtc/index' {
import { zonedTimeToUtc } from 'date-fns-tz/esm/fp'
export default zonedTimeToUtc
}
declare module 'date-fns-tz/esm/fp/zonedTimeToUtcWithOptions/index' {
import { zonedTimeToUtcWithOptions } from 'date-fns-tz/esm/fp'
export default zonedTimeToUtcWithOptions
}
declare module 'date-fns-tz/esm/fp/format/index.js' {

@@ -716,2 +716,12 @@ import { format } from 'date-fns-tz/esm/fp'

declare module 'date-fns-tz/esm/fp/fromZonedTime/index.js' {
import { fromZonedTime } from 'date-fns-tz/esm/fp'
export default fromZonedTime
}
declare module 'date-fns-tz/esm/fp/fromZonedTimeWithOptions/index.js' {
import { fromZonedTimeWithOptions } from 'date-fns-tz/esm/fp'
export default fromZonedTimeWithOptions
}
declare module 'date-fns-tz/esm/fp/getTimezoneOffset/index.js' {

@@ -732,20 +742,10 @@ import { getTimezoneOffset } from 'date-fns-tz/esm/fp'

declare module 'date-fns-tz/esm/fp/utcToZonedTime/index.js' {
import { utcToZonedTime } from 'date-fns-tz/esm/fp'
export default utcToZonedTime
declare module 'date-fns-tz/esm/fp/toZonedTime/index.js' {
import { toZonedTime } from 'date-fns-tz/esm/fp'
export default toZonedTime
}
declare module 'date-fns-tz/esm/fp/utcToZonedTimeWithOptions/index.js' {
import { utcToZonedTimeWithOptions } from 'date-fns-tz/esm/fp'
export default utcToZonedTimeWithOptions
declare module 'date-fns-tz/esm/fp/toZonedTimeWithOptions/index.js' {
import { toZonedTimeWithOptions } from 'date-fns-tz/esm/fp'
export default toZonedTimeWithOptions
}
declare module 'date-fns-tz/esm/fp/zonedTimeToUtc/index.js' {
import { zonedTimeToUtc } from 'date-fns-tz/esm/fp'
export default zonedTimeToUtc
}
declare module 'date-fns-tz/esm/fp/zonedTimeToUtcWithOptions/index.js' {
import { zonedTimeToUtcWithOptions } from 'date-fns-tz/esm/fp'
export default zonedTimeToUtcWithOptions
}
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