node_modules ignore

This commit is contained in:
2025-05-08 23:43:47 +02:00
parent e19d52f172
commit 4574544c9f
65041 changed files with 10593536 additions and 0 deletions

21
server/node_modules/date-fns-tz/LICENSE.md generated vendored Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright © 2018 Marnus Weststrate
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

313
server/node_modules/date-fns-tz/README.md generated vendored Normal file
View File

@@ -0,0 +1,313 @@
# date-fns-tz
Time zone support for [date-fns](https://date-fns.org/) v2.0.0 using the
[Intl API](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl).
By using the browser API no time zone data needs to be included in code bundles. Modern browsers
and Node.js all support the
[necessary features](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat#Browser_compatibility),
and for those that don't a [polyfill](https://formatjs.io/docs/polyfills/intl-datetimeformat) can be used.
If you do not wish to use a polyfill the time zones can still be specified as offsets
such as '-0200' or '+04:00', but not IANA time zone names.
**Note:** `date-fns` is a peer dependency of this library.
If you find this library useful, why not
<a href="https://www.buymeacoffee.com/marnusw" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: 41px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" ></a>
## ESM and CommonJS
This library supports CommonJS and native ESM imports. The exports field in [package.json](./package.json)
defines the correct entry point depending on project type, so the same import path is used for both.
Make sure to set the `type` property in your project's `package.json` to either `module`, for ESM, or `commonjs`.
Even when using ESM some CommonJS imports from `date-fns` will be used until they support
ESM natively as well [date-fns#1781](https://github.com/date-fns/date-fns/issues/1781).
This is because an ESM project cannot use ESM imports from a library that doesn't specify
`{"type": "module"}`.
## Table of Contents
- [Overview](#overview)
- [Date and time zone formatting](#date-and-time-zone-formatting)
- [`formatInTimeZone`](#formatintimezone) - Formats a date in the provided time zone,
regardless of the system time zone
- [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
- [`getTimezoneOffset`](#gettimezoneoffset) - Gets the offset in milliseconds between the time zone and UTC time
- [Low-level formatting helpers](#low-level-formatting-helpers)
- [`format`](#format) - Extends `date-fns/format` with support for all time zone tokens,
including `z..zzzz`
- [`toDate`](#todate) - Can be used to parse a `Date` from a date string representing time in
any time zone
- [Usage with Android](#usage-with-android)
## Overview
Working with UTC or ISO date strings is easy, and so is working with JS dates when all times
are displayed in a user's local time in the browser. The difficulty comes when working with another
time zone's local time, one other than the current system's, like on a Node server or when showing
the time of an event in a specific time zone, like an event in LA at 8pm PST regardless of where
a user resides.
In this case there are two relevant pieces of information:
- a fixed moment in time in the form of a timestamp, UTC or ISO date string, and
- the time zone descriptor, usually an offset or IANA time zone name (e.g. `America/New_York`).
Libraries like Moment and Luxon, which provide their own date-time classes, manage these
timestamp and time zone values internally. Since `date-fns` always returns a plain JS Date,
which implicitly has the current system's time zone, helper functions are provided for handling
common time zone related use cases.
## Date and time zone formatting
### `formatInTimeZone`
This function takes a `Date` instance in the system's local time or an ISO8601 string, and
an IANA time zone name or offset string. It then formats this date in the target time zone
regardless of the system's local time zone.
It supports the same format tokens as `date-fns/format`, and adds full support for:
- The `z..zzz` Unicode tokens: _short specific non-location format_, e.g. `EST`
- The `zzzz` Unicode token: _long specific non-location format_, e.g. `Eastern Standard Time`
Unlike `date-fns/format`, the `z..zzzz`, `x..xxxxx`, `X..XXXXX` and `O..OOO` tokens will all
print the formatted value of the provided time zone rather than the system time zone.
An invalid date or time zone input will result in an `Invalid Date` passed to `date-fns/format`,
which will throw a `RangeError`.
For most use cases this is the only function from this library you will need.
```javascript
import { formatInTimeZone } from 'date-fns-tz'
const date = new Date('2014-10-25T10:46:20Z')
formatInTimeZone(date, 'America/New_York', 'yyyy-MM-dd HH:mm:ssXXX') // 2014-10-25 06:46:20-04:00
formatInTimeZone(date, 'America/New_York', 'yyyy-MM-dd HH:mm:ss zzz') // 2014-10-25 06:46:20 EST
formatInTimeZone(date, 'Europe/Paris', 'yyyy-MM-dd HH:mm:ss zzz') // 2014-10-25 12:46:20 GMT+2
// The time zone name is generated by the Intl API which works best when a locale is also provided
import enGB from 'date-fns/locale/en-GB'
formatInTimeZone(parisDate, 'Europe/Paris', 'yyyy-MM-dd HH:mm:ss zzz', { locale: enGB })
// 2014-10-25 10:46:20 CEST
formatInTimeZone(parisDate, 'Europe/Paris', 'yyyy-MM-dd HH:mm:ss zzzz', { locale: enGB })
// 2014-10-25 10:46:20 Central European Summer Time
```
## Time zone offset helpers
These functions are useful when you are not formatting a date yourself, but passing it to
third-party code such as a date picker library alongside an input for selecting a time zone.
To discuss the usage of the time zone helpers let's assume we're writing a system where
administrators set up events which will start at a specific time in the venue's local time, and
this local time should be shown when accessing the site from anywhere in the world.
### `zonedTimeToUtc`
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`.
```ts
zonedTimeToUtc(date: Date|Number|String, timeZone: String): Date
```
Say a user is asked to input the date/time and time zone of an event. A date/time picker will
typically return a Date instance with the chosen date, in the user's local time zone, and a
select input might provide the actual IANA time zone name.
In order to work with this info effectively it is necessary to find the equivalent UTC time:
```javascript
import { zonedTimeToUtc } from 'date-fns-tz'
const date = getDatePickerValue() // e.g. 2014-06-25 10:00:00 (picked in any time zone)
const timeZone = getTimeZoneValue() // e.g. America/Los_Angeles
const utcDate = zonedTimeToUtc(date, timeZone) // In June 10am in Los Angeles is 5pm UTC
postToServer(utcDate.toISOString(), timeZone) // post 2014-06-25T17:00:00.000Z, America/Los_Angeles
```
### `utcToZonedTime`
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`.
```js
utcToZonedTime(date: Date|Number|String, timeZone: String): Date
```
Say the server provided a UTC date/time and a time zone which should be used as initial values
for the above form. The date/time picker will take a Date input which will be in the user's
local time zone, but the date value must be that of the target time zone.
```javascript
import { utcToZonedTime } 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)
renderDatePicker(date) // 2014-06-25 06:00:00 (in the system time zone)
renderTimeZoneSelect(timeZone) // America/New_York
```
### `getTimezoneOffset`
Returns the offset in milliseconds between the time zone and UTC time.
```js
getTimezoneOffset(timeZone: String, date: Date|Number): number
```
Returns the time zone offset from UTC time in milliseconds for IANA time zones as well
as other time zone offset string formats.
For time zones where daylight savings time is applicable a `Date` should be passed on
the second parameter to ensure the offset correctly accounts for DST at that time of
year. When omitted, the current date is used.
For invalid time zones, `NaN` is returned.
```javascript
import { getTimezoneOffset } from 'date-fns-tz'
const result = getTimezoneOffset('-07:00')
//=> -18000000 (-7 * 60 * 60 * 1000)
const result = getTimezoneOffset('Africa/Johannesburg')
//=> 7200000 (2 * 60 * 60 * 1000)
const result = getTimezoneOffset('America/New_York', new Date(2016, 0, 1))
//=> -18000000 (-5 * 60 * 60 * 1000)
const result = getTimezoneOffset('America/New_York', new Date(2016, 6, 1))
//=> -14400000 (-4 * 60 * 60 * 1000)
```
## Low-level formatting helpers
### `format`
The `format` function exported from this library is used under the hood by `formatInTimeZone`
and extends `date-fns/format` with full time zone support for:
- The `z..zzz` Unicode tokens: _short specific non-location format_
- The `zzzz` Unicode token: _long specific non-location format_
When using those tokens with `date-fns/format` it falls back to the GMT time zone format, and
always uses the current system's local time zone. For example `zzz` in New York will always return
`GMT-4` instead of the desired `EST`, and `zzz` in Paris `GMT+2` instead of `CEST`, making the
time zone tokens somewhat irrelevant. This extended `format` function returns the proper
specific non-location format, e.g. `EST` or `Eastern Standard Time`, and that of the target time
zone (if provided, see below) rather than the system time zone.
Since a JavaScript `Date` instance cannot convey the time zone information to the `format` function
it is necessary to pass the `timeZone` value as an option on the third argument of `format`.
Similar to `date-fns/format`, when an invalid date is used a `RangeError` is thrown. When an invalid
time zone is provided _and included in the output_, i.e. with time zone tokens in the format
string, it will also throw a `RangeError`.
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
internally. _To clarify, the `format` function will never change the underlying date, it must be
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
format it multiple times to different outputs.
```javascript
import { format, utcToZonedTime } 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')
format(nyDate, 'yyyy-MM-dd HH:mm:ssXXX', { timeZone: 'America/New_York' }) // 2014-10-25 06:46:20-04:00
format(nyDate, 'yyyy-MM-dd HH:mm:ss zzz', { timeZone: 'America/New_York' }) // 2014-10-25 06:46:20 EST
format(parisDate, 'yyyy-MM-dd HH:mm:ss zzz', { timeZone: 'Europe/Paris' }) // 2014-10-25 10:46:20 GMT+2
// The time zone name is generated by the Intl API which works best when a locale is also provided
import enGB from 'date-fns/locale/en-GB'
format(parisDate, 'yyyy-MM-dd HH:mm:ss zzz', {
timeZone: 'Europe/Paris',
locale: enGB,
})
// 2014-10-25 10:46:20 CEST
format(parisDate, 'yyyy-MM-dd HH:mm:ss zzzz', {
timeZone: 'Europe/Paris',
locale: enGB,
})
// 2014-10-25 10:46:20 Central European Summer Time
```
### `toDate`
The `toDate` function can be used to parse a `Date` from a string containing a date and time
representing time in any time zone by providing an IANA time zone name on the `timeZone` option.
An invalid date string or time zone will result in an `Invalid Date`.
```javascript
import { toDate, format } from 'date-fns-tz'
// Offsets in the date string work as usual and take precedence
const parsedDate = toDate('2014-10-25T13:46:20+04:00')
const parisDate = utcToZonedTime(parsedDate, 'Europe/Paris')
format(parisDate, 'yyyy-MM-dd HH:mm:ssxxx', { timeZone: 'Europe/Paris' }) // 2014-10-25 11:46:20+02:00
// Since toDate simply clones a Date instance, the timeZone option is effectively ignored in this case
const date = new Date('2014-10-25T13:46:20Z')
const clonedDate = toDate(date, { timeZone: 'Europe/Paris' })
assert(date.valueOf() === clonedDate.valueOf())
// When there is no offset in the date string the timeZone property is used
const parsedDate = toDate('2014-10-25T13:46:20', { timeZone: 'Asia/Bangkok' })
const bangkokDate = utcToZonedTime(parsedDate, 'Asia/Bangkok')
format(bangkokDate, 'yyyy-MM-dd HH:mm:ssxxx', { timeZone: 'Asia/Bangkok' }) // 2014-10-25 13:46:20+07:00
```
## Usage with Android
This library works with React Native, however the `Intl` API is not available by default on Android.
In projects that do not use Hermes, make this change to `android/app/build.gradle`:
```diff
- def jscFlavor = 'org.webkit:android-jsc:+'
+ def jscFlavor = 'org.webkit:android-jsc-intl:+'
```
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 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
The idea of using the Intl API for time zone support was inspired by the [Luxon](https://github.com/moment/luxon)
library.
The initial port of the idea into date-fns was done by [@benmccan](https://github.com/benmccann) in
[date-fns/#676](https://github.com/date-fns/date-fns/pull/676).
## License
MIT © Marnus Weststrate

View File

@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = newDateUTC;
/**
* Use instead of `new Date(Date.UTC(...))` to support years below 100 which doesn't work
* otherwise due to the nature of the
* [`Date` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#interpretation_of_two-digit_years.
*
* For `Date.UTC(...)`, use `newDateUTC(...).getTime()`.
*/
function newDateUTC(fullYear, month, day, hour, minute, second, millisecond) {
var utcDate = new Date(0);
utcDate.setUTCFullYear(fullYear, month, day);
utcDate.setUTCHours(hour, minute, second, millisecond);
return utcDate;
}
module.exports = exports.default;

View File

@@ -0,0 +1,47 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = tzIntlTimeZoneName;
/**
* Returns the formatted time zone name of the provided `timeZone` or the current
* system time zone if omitted, accounting for DST according to the UTC value of
* the date.
*/
function tzIntlTimeZoneName(length, date, options) {
var dtf = getDTF(length, options.timeZone, options.locale);
return dtf.formatToParts ? partsTimeZone(dtf, date) : hackyTimeZone(dtf, date);
}
function partsTimeZone(dtf, date) {
var formatted = dtf.formatToParts(date);
for (var i = formatted.length - 1; i >= 0; --i) {
if (formatted[i].type === 'timeZoneName') {
return formatted[i].value;
}
}
}
function hackyTimeZone(dtf, date) {
var formatted = dtf.format(date).replace(/\u200E/g, '');
var tzNameMatch = / [\w-+ ]+$/.exec(formatted);
return tzNameMatch ? tzNameMatch[0].substr(1) : '';
} // If a locale has been provided `en-US` is used as a fallback in case it is an
// invalid locale, otherwise the locale is left undefined to use the system locale.
function getDTF(length, timeZone, locale) {
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'`");
}
return new Intl.DateTimeFormat(locale ? [locale.code, 'en-US'] : undefined, {
timeZone: timeZone,
timeZoneName: length
});
}
module.exports = exports.default;

View File

@@ -0,0 +1,137 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
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 }; }
var MILLISECONDS_IN_HOUR = 3600000;
var MILLISECONDS_IN_MINUTE = 60000;
var patterns = {
timezone: /([Z+-].*)$/,
timezoneZ: /^(Z)$/,
timezoneHH: /^([+-]\d{2})$/,
timezoneHHMM: /^([+-])(\d{2}):?(\d{2})$/
}; // Parse various time zone offset formats to an offset in milliseconds
function tzParseTimezone(timezoneString, date, isUtcDate) {
var token;
var absoluteOffset; // Empty string
if (!timezoneString) {
return 0;
} // Z
token = patterns.timezoneZ.exec(timezoneString);
if (token) {
return 0;
}
var hours; // ±hh
token = patterns.timezoneHH.exec(timezoneString);
if (token) {
hours = parseInt(token[1], 10);
if (!validateTimezone(hours)) {
return NaN;
}
return -(hours * MILLISECONDS_IN_HOUR);
} // ±hh:mm or ±hhmm
token = patterns.timezoneHHMM.exec(timezoneString);
if (token) {
hours = parseInt(token[2], 10);
var minutes = parseInt(token[3], 10);
if (!validateTimezone(hours, minutes)) {
return NaN;
}
absoluteOffset = Math.abs(hours) * MILLISECONDS_IN_HOUR + minutes * MILLISECONDS_IN_MINUTE;
return token[1] === '+' ? -absoluteOffset : absoluteOffset;
} // IANA time zone
if (isValidTimezoneIANAString(timezoneString)) {
date = new Date(date || Date.now());
var utcDate = isUtcDate ? date : toUtcDate(date);
var offset = calcOffset(utcDate, timezoneString);
var fixedOffset = isUtcDate ? offset : fixOffset(date, offset, timezoneString);
return -fixedOffset;
}
return NaN;
}
function toUtcDate(date) {
return (0, _index2.default)(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); // 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 asTS = date.getTime();
var over = asTS % 1000;
asTS -= over >= 0 ? over : 1000 + over;
return asUTC - asTS;
}
function fixOffset(date, offset, timezoneString) {
var localTS = date.getTime(); // Our UTC time is just a guess because our offset is just a guess
var utcGuess = localTS - offset; // Test whether the zone matches the offset for this ts
var o2 = calcOffset(new Date(utcGuess), timezoneString); // If so, offset didn't change, and we're done
if (offset === o2) {
return offset;
} // If not, change the ts by the difference in the offset
utcGuess -= o2 - offset; // If that gives us the local time we want, we're done
var o3 = calcOffset(new Date(utcGuess), timezoneString);
if (o2 === o3) {
return o2;
} // If it's different, we're in a hole time. The offset has changed, but we don't adjust the time
return Math.max(o2, o3);
}
function validateTimezone(hours, minutes) {
return -23 <= hours && hours <= 23 && (minutes == null || 0 <= minutes && minutes <= 59);
}
var validIANATimezoneCache = {};
function isValidTimezoneIANAString(timeZoneString) {
if (validIANATimezoneCache[timeZoneString]) return true;
try {
new Intl.DateTimeFormat(undefined, {
timeZone: timeZoneString
});
validIANATimezoneCache[timeZoneString] = true;
return true;
} catch (error) {
return false;
}
}
module.exports = exports.default;

View File

@@ -0,0 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = 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 = tzPattern;
exports.default = _default;
module.exports = exports.default;

View File

@@ -0,0 +1,100 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = tzTokenizeDate;
/**
* Returns the [year, month, day, hour, minute, seconds] tokens of the provided
* `date` as it will be rendered in the `timeZone`.
*/
function tzTokenizeDate(date, timeZone) {
var dtf = getDateTimeFormat(timeZone);
return dtf.formatToParts ? partsOffset(dtf, date) : hackyOffset(dtf, date);
}
var typeToPos = {
year: 0,
month: 1,
day: 2,
hour: 3,
minute: 4,
second: 5
};
function partsOffset(dtf, date) {
try {
var formatted = dtf.formatToParts(date);
var filled = [];
for (var i = 0; i < formatted.length; i++) {
var pos = typeToPos[formatted[i].type];
if (pos >= 0) {
filled[pos] = parseInt(formatted[i].value, 10);
}
}
return filled;
} catch (error) {
if (error instanceof RangeError) {
return [NaN];
}
throw error;
}
}
function hackyOffset(dtf, date) {
var formatted = dtf.format(date);
var parsed = /(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(formatted); // var [, fMonth, fDay, fYear, fHour, fMinute, fSecond] = parsed
// return [fYear, fMonth, fDay, fHour, fMinute, fSecond]
return [parsed[3], parsed[1], parsed[2], parsed[4], parsed[5], parsed[6]];
} // Get a cached Intl.DateTimeFormat instance for the IANA `timeZone`. This can be used
// to get deterministic local date/time output according to the `en-US` locale which
// can be used to extract local time parts as necessary.
var dtfCache = {};
function getDateTimeFormat(timeZone) {
if (!dtfCache[timeZone]) {
// New browsers use `hourCycle`, IE and Chrome <73 does not support it and uses `hour12`
var testDateFormatted = new Intl.DateTimeFormat('en-US', {
hourCycle: 'h23',
timeZone: 'America/New_York',
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
second: '2-digit'
}).format(new Date('2014-06-25T04:00:00.123Z'));
var hourCycleSupported = testDateFormatted === '06/25/2014, 00:00:00' || testDateFormatted === '06/25/2014 00:00:00';
dtfCache[timeZone] = hourCycleSupported ? new Intl.DateTimeFormat('en-US', {
hourCycle: 'h23',
timeZone: timeZone,
year: 'numeric',
month: 'numeric',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
second: '2-digit'
}) : new Intl.DateTimeFormat('en-US', {
hour12: false,
timeZone: timeZone,
year: 'numeric',
month: 'numeric',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
second: '2-digit'
});
}
return dtfCache[timeZone];
}
module.exports = exports.default;

80
server/node_modules/date-fns-tz/docs/OptionsWithTZ.js generated vendored Normal file
View File

@@ -0,0 +1,80 @@
/**
* @category Types
* @summary An object passed as the last optional argument to all functions.
*
* @description
* An object passed as the last optional argument to all functions.
*
* @typedef {Object} OptionsWithTZ
* @property {0|1|2|3|4|5|6} [weekStartsOn=0] - the index of the first day of the week (0 - Sunday).
* Used by `differenceInCalendarWeeks`, `endOfWeek`, `format`, `getWeek`, `getWeekOfMonth`,
* `getWeeksInMonth`, `isSameWeek`, `isSameWeek`, `lastDayOfWeek`, `parse`, `setDay`,
* `setWeek`, `startOfWeek` and `startOfWeekYear`.
* @property {1|2|3|4|5|6|7} [firstWeekContainsDate=1] - the day of January,
* which is always in the first week of the year.
* Used by `format`, `getWeek`, `getWeekYear`, `parse`, `setWeek`, `setWeekYear` and `startOfWeekYear`.
* @property {0|1|2} [additionalDigits=2] - the additional number of digits in the extended year format.
* Used by all functions that take String as Date-like argument.
* Internally, passed to `toDate` to specify which way to convert extended year formatted String to Date.
* See [toDate]{@link https://date-fns.org/docs/toDate}
* @property {String} [timeZone=''] - used to specify the IANA time zone offset of a date String.
* Used by all functions that take String as Date-like argument.
* @property {Date|Number} [originalDate] - used to pick the correct IANA time zone of a date.
* Used by `format` function.
* @property {Locale} [locale=defaultLocale] - the locale object.
* Used by `formatDistance`, `formatDistanceStrict`, `format` and `parse`.
* See [Locale]{@link https://date-fns.org/docs/Locale}
* @property {Boolean} [includeSeconds=false] - used by `formatDistance`.
* If true, distances less than a minute are more detailed
* @property {Boolean} [addSuffix=false] - used by `formatDistance` and `formatDistanceStrict`.
* If true, the result will indicate if the second date is earlier or later than the first
* @property {'second'|'minute'|'hour'|'day'|'month'|'year'} [unit] - used by `formatDistanceStrict`.
* If specified, will force a unit
* @property {'floor'|'ceil'|'round'} [roundingMethod='floor'] - used by `formatDistanceStrict`.
* Specifies, which way to round partial units
* @property {Boolean} [awareOfUnicodeTokens=false] - used by `format` and `parse`.
* If true, allows usage of Unicode tokens causes confusion:
* - Some of the day of year tokens (`D`, `DD`) that are confused with the day of month tokens (`d`, `dd`).
* - Some of the local week-numbering year tokens (`YY`, `YYYY`) that are confused with the calendar year tokens (`yy`, `yyyy`).
* See: https://git.io/fxCyr
*
* @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2.
* Thrown by **all** functions
* @throws {RangeError} `options.weekStartsOn` must be between 0 and 6.
* Thrown by `differenceInCalendarWeeks`, `endOfWeek`, `format`, `getWeek`, `getWeekOfMonth`,
* `getWeeksInMonth`, `isSameWeek`, `isSameWeek`, `lastDayOfWeek`, `parse`, `setDay`,
* `setWeek`, `startOfWeek` and `startOfWeekYear`.
* @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7.
* Thrown by `format`, `getWeek`, `getWeekYear`, `parse`, `setWeek`, `setWeekYear` and `startOfWeekYear`.
* @throws {RangeError} `options.roundingMethod` must be 'floor', 'ceil' or 'round'.
* Thrown by `formatDistanceStrict`
* @throws {RangeError} `options.unit` must be 'second', 'minute', 'hour', 'day', 'month' or 'year'
* Thrown by `formatDistanceStrict`
* @throws {RangeError} `options.locale` must contain `localize` property.
* Thrown by `format` and `formatRelative`
* @throws {RangeError} `options.locale` must contain `formatLong` property.
* Thrown by `format` and `formatRelative`
* @throws {RangeError} `options.locale` must contain `formatRelative` property.
* Thrown by `formatRelative`
* @throws {RangeError} `options.locale` must contain `formatDistance` property.
* Thrown by `formatDistance` and `formatDistanceStrict`
* @throws {RangeError} `options.locale` must contain `match` property.
* Thrown by `parse`
* @throws {RangeError} `options.awareOfUnicodeTokens` must be set to `true` to use `XX` token; see: https://git.io/fxCyr
* Thrown by `format` and `parse`
*
* @example
* // For 15 December 12345 AD, represent the start of the week in Esperanto,
* // if the first day of the week is Monday:
* var eoLocale = require('date-fns/locale/eo')
* var options = {
* weekStartsOn: 1,
* additionalDigits: 1,
* locale: eoLocale
* }
* var result = format(startOfWeek('+12345-12-15', options), 'EEEE, d MMMM yyyy', options)
* //=> 'lundo, 10 decembro 12345'
*/
var OptionsWithTZ = {}
module.exports = OptionsWithTZ

32
server/node_modules/date-fns-tz/docs/index.js generated vendored Normal file
View File

@@ -0,0 +1,32 @@
const path = require('path')
module.exports = {
groups: [
'General',
'Types',
'Common Helpers',
'Interval Helpers',
'Timestamp Helpers',
'Millisecond Helpers',
'Second Helpers',
'Minute Helpers',
'Hour Helpers',
'Day Helpers',
'Weekday Helpers',
'Week Helpers',
'ISO Week Helpers',
'Month Helpers',
'Quarter Helpers',
'Year Helpers',
'ISO Week-Numbering Year Helpers',
'Decade Helpers',
],
staticDocs: [],
sharedDocs: [
{
fullPath: path.join(__dirname, 'OptionsWithTZ.js'),
},
],
}

View File

@@ -0,0 +1,13 @@
/**
* Use instead of `new Date(Date.UTC(...))` to support years below 100 which doesn't work
* otherwise due to the nature of the
* [`Date` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#interpretation_of_two-digit_years.
*
* For `Date.UTC(...)`, use `newDateUTC(...).getTime()`.
*/
export default function newDateUTC(fullYear, month, day, hour, minute, second, millisecond) {
var utcDate = new Date(0)
utcDate.setUTCFullYear(fullYear, month, day)
utcDate.setUTCHours(hour, minute, second, millisecond)
return utcDate
}

View File

@@ -0,0 +1,39 @@
/**
* Returns the formatted time zone name of the provided `timeZone` or the current
* system time zone if omitted, accounting for DST according to the UTC value of
* the date.
*/
export default function tzIntlTimeZoneName(length, date, options) {
var dtf = getDTF(length, options.timeZone, options.locale)
return dtf.formatToParts ? partsTimeZone(dtf, date) : hackyTimeZone(dtf, date)
}
function partsTimeZone(dtf, date) {
var formatted = dtf.formatToParts(date)
for (var i = formatted.length - 1; i >= 0; --i) {
if (formatted[i].type === 'timeZoneName') {
return formatted[i].value
}
}
}
function hackyTimeZone(dtf, date) {
var formatted = dtf.format(date).replace(/\u200E/g, '')
var tzNameMatch = / [\w-+ ]+$/.exec(formatted)
return tzNameMatch ? tzNameMatch[0].substr(1) : ''
}
// If a locale has been provided `en-US` is used as a fallback in case it is an
// invalid locale, otherwise the locale is left undefined to use the system locale.
function getDTF(length, timeZone, locale) {
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'`"
)
}
return new Intl.DateTimeFormat(locale ? [locale.code, 'en-US'] : undefined, {
timeZone: timeZone,
timeZoneName: length,
})
}

View File

@@ -0,0 +1,146 @@
import tzTokenizeDate from '../tzTokenizeDate/index.js'
import newDateUTC from '../newDateUTC/index.js'
var MILLISECONDS_IN_HOUR = 3600000
var MILLISECONDS_IN_MINUTE = 60000
var patterns = {
timezone: /([Z+-].*)$/,
timezoneZ: /^(Z)$/,
timezoneHH: /^([+-]\d{2})$/,
timezoneHHMM: /^([+-])(\d{2}):?(\d{2})$/,
}
// Parse various time zone offset formats to an offset in milliseconds
export default function tzParseTimezone(timezoneString, date, isUtcDate) {
var token
var absoluteOffset
// Empty string
if (!timezoneString) {
return 0
}
// Z
token = patterns.timezoneZ.exec(timezoneString)
if (token) {
return 0
}
var hours
// ±hh
token = patterns.timezoneHH.exec(timezoneString)
if (token) {
hours = parseInt(token[1], 10)
if (!validateTimezone(hours)) {
return NaN
}
return -(hours * MILLISECONDS_IN_HOUR)
}
// ±hh:mm or ±hhmm
token = patterns.timezoneHHMM.exec(timezoneString)
if (token) {
hours = parseInt(token[2], 10)
var minutes = parseInt(token[3], 10)
if (!validateTimezone(hours, minutes)) {
return NaN
}
absoluteOffset = Math.abs(hours) * MILLISECONDS_IN_HOUR + minutes * MILLISECONDS_IN_MINUTE
return token[1] === '+' ? -absoluteOffset : absoluteOffset
}
// IANA time zone
if (isValidTimezoneIANAString(timezoneString)) {
date = new Date(date || Date.now())
var utcDate = isUtcDate ? date : toUtcDate(date)
var offset = calcOffset(utcDate, timezoneString)
var fixedOffset = isUtcDate ? offset : fixOffset(date, offset, timezoneString)
return -fixedOffset
}
return NaN
}
function toUtcDate(date) {
return newDateUTC(
date.getFullYear(),
date.getMonth(),
date.getDate(),
date.getHours(),
date.getMinutes(),
date.getSeconds(),
date.getMilliseconds()
)
}
function calcOffset(date, timezoneString) {
var tokens = tzTokenizeDate(date, timezoneString)
// ms dropped because it's not provided by tzTokenizeDate
var asUTC = newDateUTC(
tokens[0],
tokens[1] - 1,
tokens[2],
tokens[3] % 24,
tokens[4],
tokens[5],
0
).getTime()
var asTS = date.getTime()
var over = asTS % 1000
asTS -= over >= 0 ? over : 1000 + over
return asUTC - asTS
}
function fixOffset(date, offset, timezoneString) {
var localTS = date.getTime()
// Our UTC time is just a guess because our offset is just a guess
var utcGuess = localTS - offset
// Test whether the zone matches the offset for this ts
var o2 = calcOffset(new Date(utcGuess), timezoneString)
// If so, offset didn't change, and we're done
if (offset === o2) {
return offset
}
// If not, change the ts by the difference in the offset
utcGuess -= o2 - offset
// If that gives us the local time we want, we're done
var o3 = calcOffset(new Date(utcGuess), timezoneString)
if (o2 === o3) {
return o2
}
// If it's different, we're in a hole time. The offset has changed, but we don't adjust the time
return Math.max(o2, o3)
}
function validateTimezone(hours, minutes) {
return -23 <= hours && hours <= 23 && (minutes == null || (0 <= minutes && minutes <= 59))
}
var validIANATimezoneCache = {}
function isValidTimezoneIANAString(timeZoneString) {
if (validIANATimezoneCache[timeZoneString]) return true
try {
new Intl.DateTimeFormat(undefined, { timeZone: timeZoneString })
validIANATimezoneCache[timeZoneString] = true
return true
} catch (error) {
return false
}
}

View File

@@ -0,0 +1,4 @@
/** 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

View File

@@ -0,0 +1,91 @@
/**
* Returns the [year, month, day, hour, minute, seconds] tokens of the provided
* `date` as it will be rendered in the `timeZone`.
*/
export default function tzTokenizeDate(date, timeZone) {
var dtf = getDateTimeFormat(timeZone)
return dtf.formatToParts ? partsOffset(dtf, date) : hackyOffset(dtf, date)
}
var typeToPos = {
year: 0,
month: 1,
day: 2,
hour: 3,
minute: 4,
second: 5,
}
function partsOffset(dtf, date) {
try {
var formatted = dtf.formatToParts(date)
var filled = []
for (var i = 0; i < formatted.length; i++) {
var pos = typeToPos[formatted[i].type]
if (pos >= 0) {
filled[pos] = parseInt(formatted[i].value, 10)
}
}
return filled
} catch (error) {
if (error instanceof RangeError) {
return [NaN]
}
throw error
}
}
function hackyOffset(dtf, date) {
var formatted = dtf.format(date)
var parsed = /(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(formatted)
// var [, fMonth, fDay, fYear, fHour, fMinute, fSecond] = parsed
// return [fYear, fMonth, fDay, fHour, fMinute, fSecond]
return [parsed[3], parsed[1], parsed[2], parsed[4], parsed[5], parsed[6]]
}
// Get a cached Intl.DateTimeFormat instance for the IANA `timeZone`. This can be used
// to get deterministic local date/time output according to the `en-US` locale which
// can be used to extract local time parts as necessary.
var dtfCache = {}
function getDateTimeFormat(timeZone) {
if (!dtfCache[timeZone]) {
// New browsers use `hourCycle`, IE and Chrome <73 does not support it and uses `hour12`
var testDateFormatted = new Intl.DateTimeFormat('en-US', {
hourCycle: 'h23',
timeZone: 'America/New_York',
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
}).format(new Date('2014-06-25T04:00:00.123Z'))
var hourCycleSupported =
testDateFormatted === '06/25/2014, 00:00:00' ||
testDateFormatted === '06/25/2014 00:00:00'
dtfCache[timeZone] = hourCycleSupported
? new Intl.DateTimeFormat('en-US', {
hourCycle: 'h23',
timeZone: timeZone,
year: 'numeric',
month: 'numeric',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
})
: new Intl.DateTimeFormat('en-US', {
hour12: false,
timeZone: timeZone,
year: 'numeric',
month: 'numeric',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
})
}
return dtfCache[timeZone]
}

View File

@@ -0,0 +1,144 @@
import tzIntlTimeZoneName from '../../_lib/tzIntlTimeZoneName/index.js'
import tzParseTimezone from '../../_lib/tzParseTimezone/index.js'
var MILLISECONDS_IN_MINUTE = 60 * 1000
var formatters = {
// Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
X: function (date, token, localize, options) {
var timezoneOffset = getTimeZoneOffset(options.timeZone, date)
if (timezoneOffset === 0) {
return 'Z'
}
switch (token) {
// Hours and optional minutes
case 'X':
return formatTimezoneWithOptionalMinutes(timezoneOffset)
// Hours, minutes and optional seconds without `:` delimeter
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
// so this token always has the same output as `XX`
case 'XXXX':
case 'XX': // Hours and minutes without `:` delimeter
return formatTimezone(timezoneOffset)
// Hours, minutes and optional seconds with `:` delimeter
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
// so this token always has the same output as `XXX`
case 'XXXXX':
case 'XXX': // Hours and minutes with `:` delimeter
default:
return formatTimezone(timezoneOffset, ':')
}
},
// Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
x: function (date, token, localize, options) {
var timezoneOffset = getTimeZoneOffset(options.timeZone, date)
switch (token) {
// Hours and optional minutes
case 'x':
return formatTimezoneWithOptionalMinutes(timezoneOffset)
// Hours, minutes and optional seconds without `:` delimeter
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
// so this token always has the same output as `xx`
case 'xxxx':
case 'xx': // Hours and minutes without `:` delimeter
return formatTimezone(timezoneOffset)
// Hours, minutes and optional seconds with `:` delimeter
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
// so this token always has the same output as `xxx`
case 'xxxxx':
case 'xxx': // Hours and minutes with `:` delimeter
default:
return formatTimezone(timezoneOffset, ':')
}
},
// Timezone (GMT)
O: function (date, token, localize, options) {
var timezoneOffset = getTimeZoneOffset(options.timeZone, date)
switch (token) {
// Short
case 'O':
case 'OO':
case 'OOO':
return 'GMT' + formatTimezoneShort(timezoneOffset, ':')
// Long
case 'OOOO':
default:
return 'GMT' + formatTimezone(timezoneOffset, ':')
}
},
// Timezone (specific non-location)
z: function (date, token, localize, options) {
switch (token) {
// Short
case 'z':
case 'zz':
case 'zzz':
return tzIntlTimeZoneName('short', date, options)
// Long
case 'zzzz':
default:
return tzIntlTimeZoneName('long', date, options)
}
},
}
function getTimeZoneOffset(timeZone, originalDate) {
var timeZoneOffset = timeZone
? tzParseTimezone(timeZone, originalDate, true) / MILLISECONDS_IN_MINUTE
: originalDate.getTimezoneOffset()
if (Number.isNaN(timeZoneOffset)) {
throw new RangeError('Invalid time zone specified: ' + timeZone)
}
return timeZoneOffset
}
function addLeadingZeros(number, targetLength) {
var sign = number < 0 ? '-' : ''
var output = Math.abs(number).toString()
while (output.length < targetLength) {
output = '0' + output
}
return sign + output
}
function formatTimezone(offset, dirtyDelimeter) {
var delimeter = dirtyDelimeter || ''
var sign = offset > 0 ? '-' : '+'
var absOffset = Math.abs(offset)
var hours = addLeadingZeros(Math.floor(absOffset / 60), 2)
var minutes = addLeadingZeros(Math.floor(absOffset % 60), 2)
return sign + hours + delimeter + minutes
}
function formatTimezoneWithOptionalMinutes(offset, dirtyDelimeter) {
if (offset % 60 === 0) {
var sign = offset > 0 ? '-' : '+'
return sign + addLeadingZeros(Math.abs(offset) / 60, 2)
}
return formatTimezone(offset, dirtyDelimeter)
}
function formatTimezoneShort(offset, dirtyDelimiter) {
var sign = offset > 0 ? '-' : '+'
var absOffset = Math.abs(offset)
var hours = Math.floor(absOffset / 60)
var minutes = absOffset % 60
if (minutes === 0) {
return sign + String(hours)
}
var delimiter = dirtyDelimiter || ''
return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2)
}
export default formatters

View File

@@ -0,0 +1,4 @@
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.
import { format } from 'date-fns-tz'
export = format

347
server/node_modules/date-fns-tz/esm/format/index.js generated vendored Normal file
View File

@@ -0,0 +1,347 @@
import dateFnsFormat from 'date-fns/format/index.js'
import formatters from './formatters/index.js'
import toDate from '../toDate/index.js'
var tzFormattingTokensRegExp = /([xXOz]+)|''|'(''|[^'])+('|$)/g
/**
* @name format
* @category Common Helpers
* @summary Format the date.
*
* @description
* Return the formatted date string in the given format. The result may vary by locale.
*
* > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
* > See: https://git.io/fxCyr
*
* The characters wrapped between two single quotes characters (') are escaped.
* Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
* (see the last example)
*
* Format of the string is based on Unicode Technical Standard #35:
* https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
* with a few additions (see note 7 below the table).
*
* Accepted patterns:
* | Unit | Pattern | Result examples | Notes |
* |---------------------------------|---------|-----------------------------------|-------|
* | Era | G..GGG | AD, BC | |
* | | GGGG | Anno Domini, Before Christ | 2 |
* | | GGGGG | A, B | |
* | Calendar year | y | 44, 1, 1900, 2017 | 5 |
* | | yo | 44th, 1st, 0th, 17th | 5,7 |
* | | yy | 44, 01, 00, 17 | 5 |
* | | yyy | 044, 001, 1900, 2017 | 5 |
* | | yyyy | 0044, 0001, 1900, 2017 | 5 |
* | | yyyyy | ... | 3,5 |
* | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |
* | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |
* | | YY | 44, 01, 00, 17 | 5,8 |
* | | YYY | 044, 001, 1900, 2017 | 5 |
* | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |
* | | YYYYY | ... | 3,5 |
* | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |
* | | RR | -43, 00, 01, 1900, 2017 | 5,7 |
* | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |
* | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |
* | | RRRRR | ... | 3,5,7 |
* | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |
* | | uu | -43, 01, 1900, 2017 | 5 |
* | | uuu | -043, 001, 1900, 2017 | 5 |
* | | uuuu | -0043, 0001, 1900, 2017 | 5 |
* | | uuuuu | ... | 3,5 |
* | Quarter (formatting) | Q | 1, 2, 3, 4 | |
* | | Qo | 1st, 2nd, 3rd, 4th | 7 |
* | | QQ | 01, 02, 03, 04 | |
* | | QQQ | Q1, Q2, Q3, Q4 | |
* | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |
* | | QQQQQ | 1, 2, 3, 4 | 4 |
* | Quarter (stand-alone) | q | 1, 2, 3, 4 | |
* | | qo | 1st, 2nd, 3rd, 4th | 7 |
* | | qq | 01, 02, 03, 04 | |
* | | qqq | Q1, Q2, Q3, Q4 | |
* | | qqqq | 1st quarter, 2nd quarter, ... | 2 |
* | | qqqqq | 1, 2, 3, 4 | 4 |
* | Month (formatting) | M | 1, 2, ..., 12 | |
* | | Mo | 1st, 2nd, ..., 12th | 7 |
* | | MM | 01, 02, ..., 12 | |
* | | MMM | Jan, Feb, ..., Dec | |
* | | MMMM | January, February, ..., December | 2 |
* | | MMMMM | J, F, ..., D | |
* | Month (stand-alone) | L | 1, 2, ..., 12 | |
* | | Lo | 1st, 2nd, ..., 12th | 7 |
* | | LL | 01, 02, ..., 12 | |
* | | LLL | Jan, Feb, ..., Dec | |
* | | LLLL | January, February, ..., December | 2 |
* | | LLLLL | J, F, ..., D | |
* | Local week of year | w | 1, 2, ..., 53 | |
* | | wo | 1st, 2nd, ..., 53th | 7 |
* | | ww | 01, 02, ..., 53 | |
* | ISO week of year | I | 1, 2, ..., 53 | 7 |
* | | Io | 1st, 2nd, ..., 53th | 7 |
* | | II | 01, 02, ..., 53 | 7 |
* | Day of month | d | 1, 2, ..., 31 | |
* | | do | 1st, 2nd, ..., 31st | 7 |
* | | dd | 01, 02, ..., 31 | |
* | Day of year | D | 1, 2, ..., 365, 366 | 8 |
* | | Do | 1st, 2nd, ..., 365th, 366th | 7 |
* | | DD | 01, 02, ..., 365, 366 | 8 |
* | | DDD | 001, 002, ..., 365, 366 | |
* | | DDDD | ... | 3 |
* | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Su | |
* | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
* | | EEEEE | M, T, W, T, F, S, S | |
* | | EEEEEE | Mo, Tu, We, Th, Fr, Su, Sa | |
* | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |
* | | io | 1st, 2nd, ..., 7th | 7 |
* | | ii | 01, 02, ..., 07 | 7 |
* | | iii | Mon, Tue, Wed, ..., Su | 7 |
* | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |
* | | iiiii | M, T, W, T, F, S, S | 7 |
* | | iiiiii | Mo, Tu, We, Th, Fr, Su, Sa | 7 |
* | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |
* | | eo | 2nd, 3rd, ..., 1st | 7 |
* | | ee | 02, 03, ..., 01 | |
* | | eee | Mon, Tue, Wed, ..., Su | |
* | | eeee | Monday, Tuesday, ..., Sunday | 2 |
* | | eeeee | M, T, W, T, F, S, S | |
* | | eeeeee | Mo, Tu, We, Th, Fr, Su, Sa | |
* | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |
* | | co | 2nd, 3rd, ..., 1st | 7 |
* | | cc | 02, 03, ..., 01 | |
* | | ccc | Mon, Tue, Wed, ..., Su | |
* | | cccc | Monday, Tuesday, ..., Sunday | 2 |
* | | ccccc | M, T, W, T, F, S, S | |
* | | cccccc | Mo, Tu, We, Th, Fr, Su, Sa | |
* | AM, PM | a..aaa | AM, PM | |
* | | aaaa | a.m., p.m. | 2 |
* | | aaaaa | a, p | |
* | AM, PM, noon, midnight | b..bbb | AM, PM, noon, midnight | |
* | | bbbb | a.m., p.m., noon, midnight | 2 |
* | | bbbbb | a, p, n, mi | |
* | Flexible day period | B..BBB | at night, in the morning, ... | |
* | | BBBB | at night, in the morning, ... | 2 |
* | | BBBBB | at night, in the morning, ... | |
* | Hour [1-12] | h | 1, 2, ..., 11, 12 | |
* | | ho | 1st, 2nd, ..., 11th, 12th | 7 |
* | | hh | 01, 02, ..., 11, 12 | |
* | Hour [0-23] | H | 0, 1, 2, ..., 23 | |
* | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |
* | | HH | 00, 01, 02, ..., 23 | |
* | Hour [0-11] | K | 1, 2, ..., 11, 0 | |
* | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |
* | | KK | 1, 2, ..., 11, 0 | |
* | Hour [1-24] | k | 24, 1, 2, ..., 23 | |
* | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |
* | | kk | 24, 01, 02, ..., 23 | |
* | Minute | m | 0, 1, ..., 59 | |
* | | mo | 0th, 1st, ..., 59th | 7 |
* | | mm | 00, 01, ..., 59 | |
* | Second | s | 0, 1, ..., 59 | |
* | | so | 0th, 1st, ..., 59th | 7 |
* | | ss | 00, 01, ..., 59 | |
* | Fraction of second | S | 0, 1, ..., 9 | |
* | | SS | 00, 01, ..., 99 | |
* | | SSS | 000, 0001, ..., 999 | |
* | | SSSS | ... | 3 |
* | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |
* | | XX | -0800, +0530, Z | |
* | | XXX | -08:00, +05:30, Z | |
* | | XXXX | -0800, +0530, Z, +123456 | 2 |
* | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |
* | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |
* | | xx | -0800, +0530, +0000 | |
* | | xxx | -08:00, +05:30, +00:00 | 2 |
* | | xxxx | -0800, +0530, +0000, +123456 | |
* | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |
* | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |
* | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |
* | Timezone (specific non-locat.) | z...zzz | PDT, EST, CEST | 6 |
* | | zzzz | Pacific Daylight Time | 2,6 |
* | Seconds timestamp | t | 512969520 | 7 |
* | | tt | ... | 3,7 |
* | Milliseconds timestamp | T | 512969520900 | 7 |
* | | TT | ... | 3,7 |
* | Long localized date | P | 05/29/1453 | 7 |
* | | PP | May 29, 1453 | 7 |
* | | PPP | May 29th, 1453 | 7 |
* | | PPPP | Sunday, May 29th, 1453 | 2,7 |
* | Long localized time | p | 12:00 AM | 7 |
* | | pp | 12:00:00 AM | 7 |
* | | ppp | 12:00:00 AM GMT+2 | 7 |
* | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |
* | Combination of date and time | Pp | 05/29/1453, 12:00 AM | 7 |
* | | PPpp | May 29, 1453, 12:00:00 AM | 7 |
* | | PPPppp | May 29th, 1453 at ... | 7 |
* | | PPPPpppp| Sunday, May 29th, 1453 at ... | 2,7 |
* Notes:
* 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
* are the same as "stand-alone" units, but are different in some languages.
* "Formatting" units are declined according to the rules of the language
* in the context of a date. "Stand-alone" units are always nominative singular:
*
* `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`
*
* `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`
*
* 2. Any sequence of the identical letters is a pattern, unless it is escaped by
* the single quote characters (see below).
* If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)
* the output will be the same as default pattern for this unit, usually
* the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units
* are marked with "2" in the last column of the table.
*
* `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`
*
* `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`
*
* `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`
*
* `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`
*
* `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`
*
* 3. Some patterns could be unlimited length (such as `yyyyyyyy`).
* The output will be padded with zeros to match the length of the pattern.
*
* `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`
*
* 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.
* These tokens represent the shortest form of the quarter.
*
* 5. The main difference between `y` and `u` patterns are B.C. years:
*
* | Year | `y` | `u` |
* |------|-----|-----|
* | AC 1 | 1 | 1 |
* | BC 1 | 1 | 0 |
* | BC 2 | 2 | -1 |
*
* Also `yy` always returns the last two digits of a year,
* while `uu` pads single digit years to 2 characters and returns other years unchanged:
*
* | Year | `yy` | `uu` |
* |------|------|------|
* | 1 | 01 | 01 |
* | 14 | 14 | 14 |
* | 376 | 76 | 376 |
* | 1453 | 53 | 1453 |
*
* The same difference is true for local and ISO week-numbering years (`Y` and `R`),
* except local week-numbering years are dependent on `options.weekStartsOn`
* and `options.firstWeekContainsDate` (compare [getISOWeekYear]{@link https://date-fns.org/docs/getISOWeekYear}
* and [getWeekYear]{@link https://date-fns.org/docs/getWeekYear}).
*
* 6. Specific non-location timezones are created using the Intl browser API. The output is determined by the
* preferred standard of the current locale (en-US by default) which may not always give the expected result.
* For this reason it is recommended to supply a `locale` in the format options when formatting a time zone name.
*
* 7. These patterns are not in the Unicode Technical Standard #35:
* - `i`: ISO day of week
* - `I`: ISO week of year
* - `R`: ISO week-numbering year
* - `t`: seconds timestamp
* - `T`: milliseconds timestamp
* - `o`: ordinal number modifier
* - `P`: long localized date
* - `p`: long localized time
*
* 8. These tokens are often confused with others. See: https://git.io/fxCyr
*
*
* ### v2.0.0 breaking changes:
*
* - [Changes that are common for the whole
* library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
*
* - The second argument is now required for the sake of explicitness.
*
* ```javascript
* // Before v2.0.0
* format(new Date(2016, 0, 1))
*
* // v2.0.0 onward
* format(new Date(2016, 0, 1), "yyyy-MM-dd'T'HH:mm:ss.SSSxxx")
* ```
*
* - New format string API for `format` function
* which is based on [Unicode Technical Standard
* #35](https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table). See [this
* post](https://blog.date-fns.org/post/unicode-tokens-in-date-fns-v2-sreatyki91jg) for more details.
*
* - Characters are now escaped using single quote symbols (`'`) instead of square brackets.
*
* @param {Date|Number} date - the original date
* @param {String} format - the string of tokens
* @param {OptionsWithTZ} [options] - the object with options. See [Options]{@link https://date-fns.org/docs/Options}
* @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link
* https://date-fns.org/docs/toDate}
* @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
* @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is
* @param {Locale} [options.locale=defaultLocale] - the locale object. See
* [Locale]{@link https://date-fns.org/docs/Locale}
* @param {Boolean} [options.awareOfUnicodeTokens=false] - if true, allows usage of Unicode tokens causes confusion:
* - Some of the day of year tokens (`D`, `DD`) that are confused with the day of month tokens (`d`, `dd`).
* - Some of the local week-numbering year tokens (`YY`, `YYYY`) that are confused with the calendar year tokens
* (`yy`, `yyyy`). See: https://git.io/fxCyr
* @param {String} [options.timeZone=''] - used to specify the IANA time zone offset of a date String.
* @param {Date|Number} [options.originalDate] - can be used to pass the original unmodified date to `format` to
* improve correctness of the replaced timezone token close to the DST threshold.
* @returns {String} the formatted date string
* @throws {TypeError} 2 arguments required
* @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2
* @throws {RangeError} `options.locale` must contain `localize` property
* @throws {RangeError} `options.locale` must contain `formatLong` property
* @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
* @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7
* @throws {RangeError} `options.awareOfUnicodeTokens` must be set to `true` to use `XX` token; see:
* https://git.io/fxCyr
*
* @example
* // Represent 11 February 2014 in middle-endian format:
* var result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
* //=> '02/11/2014'
*
* @example
* // Represent 2 July 2014 in Esperanto:
* import { eoLocale } from 'date-fns/locale/eo'
* var result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
* locale: eoLocale
* })
* //=> '2-a de julio 2014'
*
* @example
* // Escape string by single quote characters:
* var result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
* //=> "3 o'clock"
*/
export default function format(dirtyDate, dirtyFormatStr, dirtyOptions) {
var formatStr = String(dirtyFormatStr)
var options = dirtyOptions || {}
var matches = formatStr.match(tzFormattingTokensRegExp)
if (matches) {
var date = 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] === "'") {
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,
"'" + formatters[token[0]](date, token, null, options) + "'"
)
// If the replacement results in two adjoining quoted strings, the back to back quotes
// are removed, so it doesn't look like an escaped quote.
return precededByQuotedSection
? replaced.substring(0, pos - 1) + replaced.substring(pos + 1)
: replaced
}, formatStr)
}
return dateFnsFormat(dirtyDate, formatStr, options)
}

View File

@@ -0,0 +1,20 @@
// @flow
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.
import type { Locale } from 'date-fns'
type OptionsWithTZ = {
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7,
additionalDigits?: 0 | 1 | 2,
timeZone?: string,
originalDate?: Date | number,
locale?: Locale,
includeSeconds?: boolean,
addSuffix?: boolean,
unit?: 'second' | 'minute' | 'hour' | 'day' | 'month' | 'year',
roundingMethod?: 'floor' | 'ceil' | 'round',
awareOfUnicodeTokens?: boolean,
}
declare module.exports: (date: Date | number, format: string, options?: OptionsWithTZ) => string

View File

@@ -0,0 +1,5 @@
{
"sideEffects": false,
"type": "module",
"typings": "../../typings.d.ts"
}

View File

@@ -0,0 +1,4 @@
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.
import { formatInTimeZone } from 'date-fns-tz'
export = formatInTimeZone

View File

@@ -0,0 +1,32 @@
import cloneObject from 'date-fns/_lib/cloneObject/index.js'
import format from '../format/index.js'
import utcToZonedTime from '../utcToZonedTime/index.js'
/**
* @name formatInTimeZone
* @category Time Zone Helpers
* @summary Gets the offset in milliseconds between the time zone and Universal Coordinated Time (UTC)
*
* @param {Date|String|Number} date - the date representing the local time / real UTC time
* @param {String} timeZone - the time zone this date should be formatted for; can be an offset or IANA time zone
* @param {String} formatStr - the string of tokens
* @param {OptionsWithTZ} [options] - the object with options. See [Options]{@link https://date-fns.org/docs/Options}
* @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link
* https://date-fns.org/docs/toDate}
* @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
* @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is
* @param {Locale} [options.locale=defaultLocale] - the locale object. See
* [Locale]{@link https://date-fns.org/docs/Locale}
* @param {Boolean} [options.awareOfUnicodeTokens=false] - if true, allows usage of Unicode tokens causes confusion:
* - Some of the day of year tokens (`D`, `DD`) that are confused with the day of month tokens (`d`, `dd`).
* - Some of the local week-numbering year tokens (`YY`, `YYYY`) that are confused with the calendar year tokens
* (`yy`, `yyyy`). See: https://git.io/fxCyr
* @param {String} [options.timeZone=''] - used to specify the IANA time zone offset of a date String.
* @returns {String} the formatted date string
*/
export default function formatInTimeZone(date, timeZone, formatStr, options) {
var extendedOptions = cloneObject(options)
extendedOptions.timeZone = timeZone
extendedOptions.originalDate = date
return format(utcToZonedTime(date, timeZone), formatStr, extendedOptions)
}

View File

@@ -0,0 +1,25 @@
// @flow
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.
import type { Locale } from 'date-fns'
type OptionsWithTZ = {
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7,
additionalDigits?: 0 | 1 | 2,
timeZone?: string,
originalDate?: Date | number,
locale?: Locale,
includeSeconds?: boolean,
addSuffix?: boolean,
unit?: 'second' | 'minute' | 'hour' | 'day' | 'month' | 'year',
roundingMethod?: 'floor' | 'ceil' | 'round',
awareOfUnicodeTokens?: boolean,
}
declare module.exports: (
date: Date | string | number,
timeZone: string,
formatStr: string,
options?: OptionsWithTZ
) => string

View File

@@ -0,0 +1,5 @@
{
"sideEffects": false,
"type": "module",
"typings": "../../typings.d.ts"
}

View File

@@ -0,0 +1,4 @@
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.
import { format } from 'date-fns-tz/fp'
export = format

View File

@@ -0,0 +1,8 @@
// This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.
import fn from '../../format/index.js'
import convertToFP from 'date-fns/fp/_lib/convertToFP/index.js'
var format = convertToFP(fn, 2)
export default format

View File

@@ -0,0 +1,24 @@
// @flow
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.
import type { Locale } from 'date-fns'
type OptionsWithTZ = {
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7,
additionalDigits?: 0 | 1 | 2,
timeZone?: string,
originalDate?: Date | number,
locale?: Locale,
includeSeconds?: boolean,
addSuffix?: boolean,
unit?: 'second' | 'minute' | 'hour' | 'day' | 'month' | 'year',
roundingMethod?: 'floor' | 'ceil' | 'round',
awareOfUnicodeTokens?: boolean,
}
type CurriedFn1<A, R> = <A>(a: A) => R
type CurriedFn2<A, B, R> = <A>(a: A) => CurriedFn1<B, R> | (<A, B>(a: A, b: B) => R)
declare module.exports: CurriedFn2<string, Date | number, string>

View File

@@ -0,0 +1,5 @@
{
"sideEffects": false,
"type": "module",
"typings": "../../../typings.d.ts"
}

View File

@@ -0,0 +1,4 @@
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.
import { formatInTimeZone } from 'date-fns-tz/fp'
export = formatInTimeZone

View File

@@ -0,0 +1,8 @@
// This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.
import fn from '../../formatInTimeZone/index.js'
import convertToFP from 'date-fns/fp/_lib/convertToFP/index.js'
var formatInTimeZone = convertToFP(fn, 3)
export default formatInTimeZone

View File

@@ -0,0 +1,30 @@
// @flow
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.
import type { Locale } from 'date-fns'
type OptionsWithTZ = {
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7,
additionalDigits?: 0 | 1 | 2,
timeZone?: string,
originalDate?: Date | number,
locale?: Locale,
includeSeconds?: boolean,
addSuffix?: boolean,
unit?: 'second' | 'minute' | 'hour' | 'day' | 'month' | 'year',
roundingMethod?: 'floor' | 'ceil' | 'round',
awareOfUnicodeTokens?: boolean,
}
type CurriedFn1<A, R> = <A>(a: A) => R
type CurriedFn2<A, B, R> = <A>(a: A) => CurriedFn1<B, R> | (<A, B>(a: A, b: B) => R)
type CurriedFn3<A, B, C, R> = <A>(
a: A
) =>
| CurriedFn2<B, C, R>
| (<A, B>(a: A, b: B) => CurriedFn1<C, R> | (<A, B, C>(a: A, b: B, c: C) => R))
declare module.exports: CurriedFn3<string, string, Date | string | number, string>

View File

@@ -0,0 +1,5 @@
{
"sideEffects": false,
"type": "module",
"typings": "../../../typings.d.ts"
}

View File

@@ -0,0 +1,4 @@
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.
import { formatInTimeZoneWithOptions } from 'date-fns-tz/fp'
export = formatInTimeZoneWithOptions

View File

@@ -0,0 +1,8 @@
// This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.
import fn from '../../formatInTimeZone/index.js'
import convertToFP from 'date-fns/fp/_lib/convertToFP/index.js'
var formatInTimeZoneWithOptions = convertToFP(fn, 4)
export default formatInTimeZoneWithOptions

View File

@@ -0,0 +1,45 @@
// @flow
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.
import type { Locale } from 'date-fns'
type OptionsWithTZ = {
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7,
additionalDigits?: 0 | 1 | 2,
timeZone?: string,
originalDate?: Date | number,
locale?: Locale,
includeSeconds?: boolean,
addSuffix?: boolean,
unit?: 'second' | 'minute' | 'hour' | 'day' | 'month' | 'year',
roundingMethod?: 'floor' | 'ceil' | 'round',
awareOfUnicodeTokens?: boolean,
}
type CurriedFn1<A, R> = <A>(a: A) => R
type CurriedFn2<A, B, R> = <A>(a: A) => CurriedFn1<B, R> | (<A, B>(a: A, b: B) => R)
type CurriedFn3<A, B, C, R> = <A>(
a: A
) =>
| CurriedFn2<B, C, R>
| (<A, B>(a: A, b: B) => CurriedFn1<C, R> | (<A, B, C>(a: A, b: B, c: C) => R))
type CurriedFn4<A, B, C, D, R> = <A>(
a: A
) =>
| CurriedFn3<B, C, D, R>
| (<A, B>(
a: A,
b: B
) =>
| CurriedFn2<C, D, R>
| (<A, B, C>(
a: A,
b: B,
c: C
) => CurriedFn1<D, R> | (<A, B, C, D>(a: A, b: B, c: C, d: D) => R)))
declare module.exports: CurriedFn4<OptionsWithTZ, string, string, Date | string | number, string>

View File

@@ -0,0 +1,5 @@
{
"sideEffects": false,
"type": "module",
"typings": "../../../typings.d.ts"
}

View File

@@ -0,0 +1,4 @@
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.
import { formatWithOptions } from 'date-fns-tz/fp'
export = formatWithOptions

View File

@@ -0,0 +1,8 @@
// This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.
import fn from '../../format/index.js'
import convertToFP from 'date-fns/fp/_lib/convertToFP/index.js'
var formatWithOptions = convertToFP(fn, 3)
export default formatWithOptions

View File

@@ -0,0 +1,30 @@
// @flow
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.
import type { Locale } from 'date-fns'
type OptionsWithTZ = {
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7,
additionalDigits?: 0 | 1 | 2,
timeZone?: string,
originalDate?: Date | number,
locale?: Locale,
includeSeconds?: boolean,
addSuffix?: boolean,
unit?: 'second' | 'minute' | 'hour' | 'day' | 'month' | 'year',
roundingMethod?: 'floor' | 'ceil' | 'round',
awareOfUnicodeTokens?: boolean,
}
type CurriedFn1<A, R> = <A>(a: A) => R
type CurriedFn2<A, B, R> = <A>(a: A) => CurriedFn1<B, R> | (<A, B>(a: A, b: B) => R)
type CurriedFn3<A, B, C, R> = <A>(
a: A
) =>
| CurriedFn2<B, C, R>
| (<A, B>(a: A, b: B) => CurriedFn1<C, R> | (<A, B, C>(a: A, b: B, c: C) => R))
declare module.exports: CurriedFn3<OptionsWithTZ, string, Date | number, string>

View File

@@ -0,0 +1,5 @@
{
"sideEffects": false,
"type": "module",
"typings": "../../../typings.d.ts"
}

View File

@@ -0,0 +1,4 @@
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.
import { getTimezoneOffset } from 'date-fns-tz/fp'
export = getTimezoneOffset

View File

@@ -0,0 +1,8 @@
// This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.
import fn from '../../getTimezoneOffset/index.js'
import convertToFP from 'date-fns/fp/_lib/convertToFP/index.js'
var getTimezoneOffset = convertToFP(fn, 2)
export default getTimezoneOffset

View File

@@ -0,0 +1,24 @@
// @flow
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.
import type { Locale } from 'date-fns'
type OptionsWithTZ = {
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7,
additionalDigits?: 0 | 1 | 2,
timeZone?: string,
originalDate?: Date | number,
locale?: Locale,
includeSeconds?: boolean,
addSuffix?: boolean,
unit?: 'second' | 'minute' | 'hour' | 'day' | 'month' | 'year',
roundingMethod?: 'floor' | 'ceil' | 'round',
awareOfUnicodeTokens?: boolean,
}
type CurriedFn1<A, R> = <A>(a: A) => R
type CurriedFn2<A, B, R> = <A>(a: A) => CurriedFn1<B, R> | (<A, B>(a: A, b: B) => R)
declare module.exports: CurriedFn2<Date | number, string, number>

View File

@@ -0,0 +1,5 @@
{
"sideEffects": false,
"type": "module",
"typings": "../../../typings.d.ts"
}

13
server/node_modules/date-fns-tz/esm/fp/index.js generated vendored Normal file
View File

@@ -0,0 +1,13 @@
// 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'

63
server/node_modules/date-fns-tz/esm/fp/index.js.flow generated vendored Normal file
View File

@@ -0,0 +1,63 @@
// @flow
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.
import type { Locale } from 'date-fns'
type OptionsWithTZ = {
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7,
additionalDigits?: 0 | 1 | 2,
timeZone?: string,
originalDate?: Date | number,
locale?: Locale,
includeSeconds?: boolean,
addSuffix?: boolean,
unit?: 'second' | 'minute' | 'hour' | 'day' | 'month' | 'year',
roundingMethod?: 'floor' | 'ceil' | 'round',
awareOfUnicodeTokens?: boolean,
}
type CurriedFn1<A, R> = <A>(a: A) => R
type CurriedFn2<A, B, R> = <A>(a: A) => CurriedFn1<B, R> | (<A, B>(a: A, b: B) => R)
type CurriedFn3<A, B, C, R> = <A>(
a: A
) =>
| CurriedFn2<B, C, R>
| (<A, B>(a: A, b: B) => CurriedFn1<C, R> | (<A, B, C>(a: A, b: B, c: C) => R))
type CurriedFn4<A, B, C, D, R> = <A>(
a: A
) =>
| CurriedFn3<B, C, D, R>
| (<A, B>(
a: A,
b: B
) =>
| CurriedFn2<C, D, R>
| (<A, B, C>(
a: A,
b: B,
c: C
) => CurriedFn1<D, R> | (<A, B, C, D>(a: A, b: B, c: C, d: D) => R)))
declare module.exports: {
format: CurriedFn2<string, Date | number, string>,
formatInTimeZone: CurriedFn3<string, string, Date | string | number, string>,
formatInTimeZoneWithOptions: CurriedFn4<
OptionsWithTZ,
string,
string,
Date | string | number,
string
>,
formatWithOptions: CurriedFn3<OptionsWithTZ, string, Date | number, string>,
getTimezoneOffset: CurriedFn2<Date | number, string, number>,
toDate: CurriedFn1<Date | string | number, Date>,
toDateWithOptions: CurriedFn2<OptionsWithTZ, Date | string | number, Date>,
utcToZonedTime: CurriedFn2<string, Date | string | number, Date>,
utcToZonedTimeWithOptions: CurriedFn3<OptionsWithTZ, string, Date | string | number, Date>,
zonedTimeToUtc: CurriedFn2<string, Date | string | number, Date>,
zonedTimeToUtcWithOptions: CurriedFn3<OptionsWithTZ, string, Date | string | number, Date>,
}

5
server/node_modules/date-fns-tz/esm/fp/package.json generated vendored Normal file
View File

@@ -0,0 +1,5 @@
{
"sideEffects": false,
"type": "module",
"typings": "../../typings.d.ts"
}

View File

@@ -0,0 +1,4 @@
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.
import { toDate } from 'date-fns-tz/fp'
export = toDate

View File

@@ -0,0 +1,8 @@
// This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.
import fn from '../../toDate/index.js'
import convertToFP from 'date-fns/fp/_lib/convertToFP/index.js'
var toDate = convertToFP(fn, 1)
export default toDate

View File

@@ -0,0 +1,22 @@
// @flow
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.
import type { Locale } from 'date-fns'
type OptionsWithTZ = {
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7,
additionalDigits?: 0 | 1 | 2,
timeZone?: string,
originalDate?: Date | number,
locale?: Locale,
includeSeconds?: boolean,
addSuffix?: boolean,
unit?: 'second' | 'minute' | 'hour' | 'day' | 'month' | 'year',
roundingMethod?: 'floor' | 'ceil' | 'round',
awareOfUnicodeTokens?: boolean,
}
type CurriedFn1<A, R> = <A>(a: A) => R
declare module.exports: CurriedFn1<Date | string | number, Date>

View File

@@ -0,0 +1,5 @@
{
"sideEffects": false,
"type": "module",
"typings": "../../../typings.d.ts"
}

View File

@@ -0,0 +1,4 @@
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.
import { toDateWithOptions } from 'date-fns-tz/fp'
export = toDateWithOptions

View File

@@ -0,0 +1,8 @@
// This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.
import fn from '../../toDate/index.js'
import convertToFP from 'date-fns/fp/_lib/convertToFP/index.js'
var toDateWithOptions = convertToFP(fn, 2)
export default toDateWithOptions

View File

@@ -0,0 +1,24 @@
// @flow
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.
import type { Locale } from 'date-fns'
type OptionsWithTZ = {
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7,
additionalDigits?: 0 | 1 | 2,
timeZone?: string,
originalDate?: Date | number,
locale?: Locale,
includeSeconds?: boolean,
addSuffix?: boolean,
unit?: 'second' | 'minute' | 'hour' | 'day' | 'month' | 'year',
roundingMethod?: 'floor' | 'ceil' | 'round',
awareOfUnicodeTokens?: boolean,
}
type CurriedFn1<A, R> = <A>(a: A) => R
type CurriedFn2<A, B, R> = <A>(a: A) => CurriedFn1<B, R> | (<A, B>(a: A, b: B) => R)
declare module.exports: CurriedFn2<OptionsWithTZ, Date | string | number, Date>

View File

@@ -0,0 +1,5 @@
{
"sideEffects": false,
"type": "module",
"typings": "../../../typings.d.ts"
}

View File

@@ -0,0 +1,4 @@
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.
import { utcToZonedTime } from 'date-fns-tz/fp'
export = utcToZonedTime

View File

@@ -0,0 +1,8 @@
// This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.
import fn from '../../utcToZonedTime/index.js'
import convertToFP from 'date-fns/fp/_lib/convertToFP/index.js'
var utcToZonedTime = convertToFP(fn, 2)
export default utcToZonedTime

View File

@@ -0,0 +1,24 @@
// @flow
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.
import type { Locale } from 'date-fns'
type OptionsWithTZ = {
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7,
additionalDigits?: 0 | 1 | 2,
timeZone?: string,
originalDate?: Date | number,
locale?: Locale,
includeSeconds?: boolean,
addSuffix?: boolean,
unit?: 'second' | 'minute' | 'hour' | 'day' | 'month' | 'year',
roundingMethod?: 'floor' | 'ceil' | 'round',
awareOfUnicodeTokens?: boolean,
}
type CurriedFn1<A, R> = <A>(a: A) => R
type CurriedFn2<A, B, R> = <A>(a: A) => CurriedFn1<B, R> | (<A, B>(a: A, b: B) => R)
declare module.exports: CurriedFn2<string, Date | string | number, Date>

View File

@@ -0,0 +1,5 @@
{
"sideEffects": false,
"type": "module",
"typings": "../../../typings.d.ts"
}

View File

@@ -0,0 +1,4 @@
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.
import { utcToZonedTimeWithOptions } from 'date-fns-tz/fp'
export = utcToZonedTimeWithOptions

View File

@@ -0,0 +1,8 @@
// This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.
import fn from '../../utcToZonedTime/index.js'
import convertToFP from 'date-fns/fp/_lib/convertToFP/index.js'
var utcToZonedTimeWithOptions = convertToFP(fn, 3)
export default utcToZonedTimeWithOptions

View File

@@ -0,0 +1,30 @@
// @flow
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.
import type { Locale } from 'date-fns'
type OptionsWithTZ = {
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7,
additionalDigits?: 0 | 1 | 2,
timeZone?: string,
originalDate?: Date | number,
locale?: Locale,
includeSeconds?: boolean,
addSuffix?: boolean,
unit?: 'second' | 'minute' | 'hour' | 'day' | 'month' | 'year',
roundingMethod?: 'floor' | 'ceil' | 'round',
awareOfUnicodeTokens?: boolean,
}
type CurriedFn1<A, R> = <A>(a: A) => R
type CurriedFn2<A, B, R> = <A>(a: A) => CurriedFn1<B, R> | (<A, B>(a: A, b: B) => R)
type CurriedFn3<A, B, C, R> = <A>(
a: A
) =>
| CurriedFn2<B, C, R>
| (<A, B>(a: A, b: B) => CurriedFn1<C, R> | (<A, B, C>(a: A, b: B, c: C) => R))
declare module.exports: CurriedFn3<OptionsWithTZ, string, Date | string | number, Date>

View File

@@ -0,0 +1,5 @@
{
"sideEffects": false,
"type": "module",
"typings": "../../../typings.d.ts"
}

View File

@@ -0,0 +1,4 @@
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.
import { zonedTimeToUtc } from 'date-fns-tz/fp'
export = zonedTimeToUtc

View File

@@ -0,0 +1,8 @@
// This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.
import fn from '../../zonedTimeToUtc/index.js'
import convertToFP from 'date-fns/fp/_lib/convertToFP/index.js'
var zonedTimeToUtc = convertToFP(fn, 2)
export default zonedTimeToUtc

View File

@@ -0,0 +1,24 @@
// @flow
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.
import type { Locale } from 'date-fns'
type OptionsWithTZ = {
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7,
additionalDigits?: 0 | 1 | 2,
timeZone?: string,
originalDate?: Date | number,
locale?: Locale,
includeSeconds?: boolean,
addSuffix?: boolean,
unit?: 'second' | 'minute' | 'hour' | 'day' | 'month' | 'year',
roundingMethod?: 'floor' | 'ceil' | 'round',
awareOfUnicodeTokens?: boolean,
}
type CurriedFn1<A, R> = <A>(a: A) => R
type CurriedFn2<A, B, R> = <A>(a: A) => CurriedFn1<B, R> | (<A, B>(a: A, b: B) => R)
declare module.exports: CurriedFn2<string, Date | string | number, Date>

View File

@@ -0,0 +1,5 @@
{
"sideEffects": false,
"type": "module",
"typings": "../../../typings.d.ts"
}

View File

@@ -0,0 +1,4 @@
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.
import { zonedTimeToUtcWithOptions } from 'date-fns-tz/fp'
export = zonedTimeToUtcWithOptions

View File

@@ -0,0 +1,8 @@
// This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.
import fn from '../../zonedTimeToUtc/index.js'
import convertToFP from 'date-fns/fp/_lib/convertToFP/index.js'
var zonedTimeToUtcWithOptions = convertToFP(fn, 3)
export default zonedTimeToUtcWithOptions

View File

@@ -0,0 +1,30 @@
// @flow
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.
import type { Locale } from 'date-fns'
type OptionsWithTZ = {
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7,
additionalDigits?: 0 | 1 | 2,
timeZone?: string,
originalDate?: Date | number,
locale?: Locale,
includeSeconds?: boolean,
addSuffix?: boolean,
unit?: 'second' | 'minute' | 'hour' | 'day' | 'month' | 'year',
roundingMethod?: 'floor' | 'ceil' | 'round',
awareOfUnicodeTokens?: boolean,
}
type CurriedFn1<A, R> = <A>(a: A) => R
type CurriedFn2<A, B, R> = <A>(a: A) => CurriedFn1<B, R> | (<A, B>(a: A, b: B) => R)
type CurriedFn3<A, B, C, R> = <A>(
a: A
) =>
| CurriedFn2<B, C, R>
| (<A, B>(a: A, b: B) => CurriedFn1<C, R> | (<A, B, C>(a: A, b: B, c: C) => R))
declare module.exports: CurriedFn3<OptionsWithTZ, string, Date | string | number, Date>

View File

@@ -0,0 +1,5 @@
{
"sideEffects": false,
"type": "module",
"typings": "../../../typings.d.ts"
}

View File

@@ -0,0 +1,4 @@
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.
import { getTimezoneOffset } from 'date-fns-tz'
export = getTimezoneOffset

View File

@@ -0,0 +1,32 @@
import tzParseTimezone from '../_lib/tzParseTimezone/index.js'
/**
* @name getTimezoneOffset
* @category Time Zone Helpers
* @summary Gets the offset in milliseconds between the time zone and Universal Coordinated Time (UTC)
*
* @description
* Returns the time zone offset from UTC time in milliseconds for IANA time zones as well
* as other time zone offset string formats.
*
* For time zones where daylight savings time is applicable a `Date` should be passed on
* the second parameter to ensure the offset correctly accounts for DST at that time of
* year. When omitted, the current date is used.
*
* @param {String} timeZone - the time zone of this local time, can be an offset or IANA time zone
* @param {Date|Number} [date] - the date with values representing the local time
* @returns {Number} the time zone offset in milliseconds
*
* @example
* const result = getTimezoneOffset('-07:00')
* //=> -18000000 (-7 * 60 * 60 * 1000)
* const result = getTimezoneOffset('Africa/Johannesburg')
* //=> 7200000 (2 * 60 * 60 * 1000)
* const result = getTimezoneOffset('America/New_York', new Date(2016, 0, 1))
* //=> -18000000 (-5 * 60 * 60 * 1000)
* const result = getTimezoneOffset('America/New_York', new Date(2016, 6, 1))
* //=> -14400000 (-4 * 60 * 60 * 1000)
*/
export default function getTimezoneOffset(timeZone, date) {
return -tzParseTimezone(timeZone, date)
}

View File

@@ -0,0 +1,20 @@
// @flow
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.
import type { Locale } from 'date-fns'
type OptionsWithTZ = {
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7,
additionalDigits?: 0 | 1 | 2,
timeZone?: string,
originalDate?: Date | number,
locale?: Locale,
includeSeconds?: boolean,
addSuffix?: boolean,
unit?: 'second' | 'minute' | 'hour' | 'day' | 'month' | 'year',
roundingMethod?: 'floor' | 'ceil' | 'round',
awareOfUnicodeTokens?: boolean,
}
declare module.exports: (timeZone: string, date?: Date | number) => number

View File

@@ -0,0 +1,5 @@
{
"sideEffects": false,
"type": "module",
"typings": "../../typings.d.ts"
}

8
server/node_modules/date-fns-tz/esm/index.js generated vendored Normal file
View File

@@ -0,0 +1,8 @@
// 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'

37
server/node_modules/date-fns-tz/esm/index.js.flow generated vendored Normal file
View File

@@ -0,0 +1,37 @@
// @flow
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.
import type { Locale } from 'date-fns'
type OptionsWithTZ = {
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7,
additionalDigits?: 0 | 1 | 2,
timeZone?: string,
originalDate?: Date | number,
locale?: Locale,
includeSeconds?: boolean,
addSuffix?: boolean,
unit?: 'second' | 'minute' | 'hour' | 'day' | 'month' | 'year',
roundingMethod?: 'floor' | 'ceil' | 'round',
awareOfUnicodeTokens?: boolean,
}
declare module.exports: {
format: (date: Date | number, format: string, options?: OptionsWithTZ) => string,
formatInTimeZone: (
date: Date | string | number,
timeZone: string,
formatStr: string,
options?: OptionsWithTZ
) => string,
getTimezoneOffset: (timeZone: string, date?: Date | number) => number,
toDate: (argument: Date | string | number, options?: OptionsWithTZ) => Date,
utcToZonedTime: (date: Date | string | number, timeZone: string, options?: OptionsWithTZ) => Date,
zonedTimeToUtc: (date: Date | string | number, timeZone: string, options?: OptionsWithTZ) => Date,
}

3
server/node_modules/date-fns-tz/esm/package.json generated vendored Normal file
View File

@@ -0,0 +1,3 @@
{
"type": "module"
}

View File

@@ -0,0 +1,4 @@
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.
import { toDate } from 'date-fns-tz'
export = toDate

452
server/node_modules/date-fns-tz/esm/toDate/index.js generated vendored Normal file
View File

@@ -0,0 +1,452 @@
import toInteger from 'date-fns/_lib/toInteger/index.js'
import getTimezoneOffsetInMilliseconds from 'date-fns/_lib/getTimezoneOffsetInMilliseconds/index.js'
import tzParseTimezone from '../_lib/tzParseTimezone/index.js'
import tzPattern from '../_lib/tzPattern/index.js'
var MILLISECONDS_IN_HOUR = 3600000
var MILLISECONDS_IN_MINUTE = 60000
var DEFAULT_ADDITIONAL_DIGITS = 2
var patterns = {
dateTimePattern: /^([0-9W+-]+)(T| )(.*)/,
datePattern: /^([0-9W+-]+)(.*)/,
plainTime: /:/,
// year tokens
YY: /^(\d{2})$/,
YYY: [
/^([+-]\d{2})$/, // 0 additional digits
/^([+-]\d{3})$/, // 1 additional digit
/^([+-]\d{4})$/, // 2 additional digits
],
YYYY: /^(\d{4})/,
YYYYY: [
/^([+-]\d{4})/, // 0 additional digits
/^([+-]\d{5})/, // 1 additional digit
/^([+-]\d{6})/, // 2 additional digits
],
// date tokens
MM: /^-(\d{2})$/,
DDD: /^-?(\d{3})$/,
MMDD: /^-?(\d{2})-?(\d{2})$/,
Www: /^-?W(\d{2})$/,
WwwD: /^-?W(\d{2})-?(\d{1})$/,
HH: /^(\d{2}([.,]\d*)?)$/,
HHMM: /^(\d{2}):?(\d{2}([.,]\d*)?)$/,
HHMMSS: /^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,
// time zone tokens (to identify the presence of a tz)
timeZone: tzPattern,
}
/**
* @name toDate
* @category Common Helpers
* @summary Convert the given argument to an instance of Date.
*
* @description
* Convert the given argument to an instance of Date.
*
* If the argument is an instance of Date, the function returns its clone.
*
* If the argument is a number, it is treated as a timestamp.
*
* If an argument is a string, the function tries to parse it.
* Function accepts complete ISO 8601 formats as well as partial implementations.
* ISO 8601: http://en.wikipedia.org/wiki/ISO_8601
* If the function cannot parse the string or the values are invalid, it returns Invalid Date.
*
* If the argument is none of the above, the function returns Invalid Date.
*
* **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
* All *date-fns* functions will throw `RangeError` if `options.additionalDigits` is not 0, 1, 2 or undefined.
*
* @param {Date|String|Number} argument - the value to convert
* @param {OptionsWithTZ} [options] - the object with options. See [Options]{@link https://date-fns.org/docs/Options}
* @param {0|1|2} [options.additionalDigits=2] - the additional number of digits in the extended year format
* @param {String} [options.timeZone=''] - used to specify the IANA time zone offset of a date String.
* @returns {Date} the parsed date in the local time zone
* @throws {TypeError} 1 argument required
* @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2
*
* @example
* // Convert string '2014-02-11T11:30:30' to date:
* var result = toDate('2014-02-11T11:30:30')
* //=> Tue Feb 11 2014 11:30:30
*
* @example
* // Convert string '+02014101' to date,
* // if the additional number of digits in the extended year format is 1:
* var result = toDate('+02014101', {additionalDigits: 1})
* //=> Fri Apr 11 2014 00:00:00
*/
export default function toDate(argument, dirtyOptions) {
if (arguments.length < 1) {
throw new TypeError('1 argument required, but only ' + arguments.length + ' present')
}
if (argument === null) {
return new Date(NaN)
}
var options = dirtyOptions || {}
var additionalDigits =
options.additionalDigits == null
? DEFAULT_ADDITIONAL_DIGITS
: toInteger(options.additionalDigits)
if (additionalDigits !== 2 && additionalDigits !== 1 && additionalDigits !== 0) {
throw new RangeError('additionalDigits must be 0, 1 or 2')
}
// Clone the date
if (
argument instanceof Date ||
(typeof argument === 'object' && Object.prototype.toString.call(argument) === '[object Date]')
) {
// Prevent the date to lose the milliseconds when passed to new Date() in IE10
return new Date(argument.getTime())
} else if (
typeof argument === 'number' ||
Object.prototype.toString.call(argument) === '[object Number]'
) {
return new Date(argument)
} else if (
!(
typeof argument === 'string' || Object.prototype.toString.call(argument) === '[object String]'
)
) {
return new Date(NaN)
}
var dateStrings = splitDateString(argument)
var parseYearResult = parseYear(dateStrings.date, additionalDigits)
var year = parseYearResult.year
var restDateString = parseYearResult.restDateString
var date = parseDate(restDateString, year)
if (isNaN(date)) {
return new Date(NaN)
}
if (date) {
var timestamp = date.getTime()
var time = 0
var offset
if (dateStrings.time) {
time = parseTime(dateStrings.time)
if (isNaN(time)) {
return new Date(NaN)
}
}
if (dateStrings.timeZone || options.timeZone) {
offset = tzParseTimezone(dateStrings.timeZone || options.timeZone, new Date(timestamp + time))
if (isNaN(offset)) {
return new Date(NaN)
}
} else {
// get offset accurate to hour in time zones that change offset
offset = getTimezoneOffsetInMilliseconds(new Date(timestamp + time))
offset = getTimezoneOffsetInMilliseconds(new Date(timestamp + time + offset))
}
return new Date(timestamp + time + offset)
} else {
return new Date(NaN)
}
}
function splitDateString(dateString) {
var dateStrings = {}
var parts = patterns.dateTimePattern.exec(dateString)
var timeString
if (!parts) {
parts = patterns.datePattern.exec(dateString)
if (parts) {
dateStrings.date = parts[1]
timeString = parts[2]
} else {
dateStrings.date = null
timeString = dateString
}
} else {
dateStrings.date = parts[1]
timeString = parts[3]
}
if (timeString) {
var token = patterns.timeZone.exec(timeString)
if (token) {
dateStrings.time = timeString.replace(token[1], '')
dateStrings.timeZone = token[1].trim()
} else {
dateStrings.time = timeString
}
}
return dateStrings
}
function parseYear(dateString, additionalDigits) {
var patternYYY = patterns.YYY[additionalDigits]
var patternYYYYY = patterns.YYYYY[additionalDigits]
var token
// YYYY or ±YYYYY
token = patterns.YYYY.exec(dateString) || patternYYYYY.exec(dateString)
if (token) {
var yearString = token[1]
return {
year: parseInt(yearString, 10),
restDateString: dateString.slice(yearString.length),
}
}
// YY or ±YYY
token = patterns.YY.exec(dateString) || patternYYY.exec(dateString)
if (token) {
var centuryString = token[1]
return {
year: parseInt(centuryString, 10) * 100,
restDateString: dateString.slice(centuryString.length),
}
}
// Invalid ISO-formatted year
return {
year: null,
}
}
function parseDate(dateString, year) {
// Invalid ISO-formatted year
if (year === null) {
return null
}
var token
var date
var month
var week
// YYYY
if (dateString.length === 0) {
date = new Date(0)
date.setUTCFullYear(year)
return date
}
// YYYY-MM
token = patterns.MM.exec(dateString)
if (token) {
date = new Date(0)
month = parseInt(token[1], 10) - 1
if (!validateDate(year, month)) {
return new Date(NaN)
}
date.setUTCFullYear(year, month)
return date
}
// YYYY-DDD or YYYYDDD
token = patterns.DDD.exec(dateString)
if (token) {
date = new Date(0)
var dayOfYear = parseInt(token[1], 10)
if (!validateDayOfYearDate(year, dayOfYear)) {
return new Date(NaN)
}
date.setUTCFullYear(year, 0, dayOfYear)
return date
}
// yyyy-MM-dd or YYYYMMDD
token = patterns.MMDD.exec(dateString)
if (token) {
date = new Date(0)
month = parseInt(token[1], 10) - 1
var day = parseInt(token[2], 10)
if (!validateDate(year, month, day)) {
return new Date(NaN)
}
date.setUTCFullYear(year, month, day)
return date
}
// YYYY-Www or YYYYWww
token = patterns.Www.exec(dateString)
if (token) {
week = parseInt(token[1], 10) - 1
if (!validateWeekDate(year, week)) {
return new Date(NaN)
}
return dayOfISOWeekYear(year, week)
}
// YYYY-Www-D or YYYYWwwD
token = patterns.WwwD.exec(dateString)
if (token) {
week = parseInt(token[1], 10) - 1
var dayOfWeek = parseInt(token[2], 10) - 1
if (!validateWeekDate(year, week, dayOfWeek)) {
return new Date(NaN)
}
return dayOfISOWeekYear(year, week, dayOfWeek)
}
// Invalid ISO-formatted date
return null
}
function parseTime(timeString) {
var token
var hours
var minutes
// hh
token = patterns.HH.exec(timeString)
if (token) {
hours = parseFloat(token[1].replace(',', '.'))
if (!validateTime(hours)) {
return NaN
}
return (hours % 24) * MILLISECONDS_IN_HOUR
}
// hh:mm or hhmm
token = patterns.HHMM.exec(timeString)
if (token) {
hours = parseInt(token[1], 10)
minutes = parseFloat(token[2].replace(',', '.'))
if (!validateTime(hours, minutes)) {
return NaN
}
return (hours % 24) * MILLISECONDS_IN_HOUR + minutes * MILLISECONDS_IN_MINUTE
}
// hh:mm:ss or hhmmss
token = patterns.HHMMSS.exec(timeString)
if (token) {
hours = parseInt(token[1], 10)
minutes = parseInt(token[2], 10)
var seconds = parseFloat(token[3].replace(',', '.'))
if (!validateTime(hours, minutes, seconds)) {
return NaN
}
return (hours % 24) * MILLISECONDS_IN_HOUR + minutes * MILLISECONDS_IN_MINUTE + seconds * 1000
}
// Invalid ISO-formatted time
return null
}
function dayOfISOWeekYear(isoWeekYear, week, day) {
week = week || 0
day = day || 0
var date = new Date(0)
date.setUTCFullYear(isoWeekYear, 0, 4)
var fourthOfJanuaryDay = date.getUTCDay() || 7
var diff = week * 7 + day + 1 - fourthOfJanuaryDay
date.setUTCDate(date.getUTCDate() + diff)
return date
}
// Validation functions
var DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
var DAYS_IN_MONTH_LEAP_YEAR = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
function isLeapYearIndex(year) {
return year % 400 === 0 || (year % 4 === 0 && year % 100 !== 0)
}
function validateDate(year, month, date) {
if (month < 0 || month > 11) {
return false
}
if (date != null) {
if (date < 1) {
return false
}
var isLeapYear = isLeapYearIndex(year)
if (isLeapYear && date > DAYS_IN_MONTH_LEAP_YEAR[month]) {
return false
}
if (!isLeapYear && date > DAYS_IN_MONTH[month]) {
return false
}
}
return true
}
function validateDayOfYearDate(year, dayOfYear) {
if (dayOfYear < 1) {
return false
}
var isLeapYear = isLeapYearIndex(year)
if (isLeapYear && dayOfYear > 366) {
return false
}
if (!isLeapYear && dayOfYear > 365) {
return false
}
return true
}
function validateWeekDate(year, week, day) {
if (week < 0 || week > 52) {
return false
}
if (day != null && (day < 0 || day > 6)) {
return false
}
return true
}
function validateTime(hours, minutes, seconds) {
if (hours != null && (hours < 0 || hours >= 25)) {
return false
}
if (minutes != null && (minutes < 0 || minutes >= 60)) {
return false
}
if (seconds != null && (seconds < 0 || seconds >= 60)) {
return false
}
return true
}

View File

@@ -0,0 +1,20 @@
// @flow
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.
import type { Locale } from 'date-fns'
type OptionsWithTZ = {
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7,
additionalDigits?: 0 | 1 | 2,
timeZone?: string,
originalDate?: Date | number,
locale?: Locale,
includeSeconds?: boolean,
addSuffix?: boolean,
unit?: 'second' | 'minute' | 'hour' | 'day' | 'month' | 'year',
roundingMethod?: 'floor' | 'ceil' | 'round',
awareOfUnicodeTokens?: boolean,
}
declare module.exports: (argument: Date | string | number, options?: OptionsWithTZ) => Date

View File

@@ -0,0 +1,5 @@
{
"sideEffects": false,
"type": "module",
"typings": "../../typings.d.ts"
}

View File

@@ -0,0 +1,4 @@
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.
import { utcToZonedTime } from 'date-fns-tz'
export = utcToZonedTime

View File

@@ -0,0 +1,42 @@
import tzParseTimezone from '../_lib/tzParseTimezone/index.js'
import toDate from '../toDate/index.js'
/**
* @name utcToZonedTime
* @category Time Zone Helpers
* @summary Get a date/time representing local time in a given time zone from the UTC date
*
* @description
* Returns a date instance with values representing the local time in the time zone
* specified of the UTC time from the date provided. In other words, when the new date
* is formatted it will show the equivalent hours in the target time zone regardless
* of the current system time zone.
*
* @param {Date|String|Number} date - the date with the relevant UTC time
* @param {String} timeZone - the time zone to get local time for, can be an offset or IANA time zone
* @param {OptionsWithTZ} [options] - the object with options. See [Options]{@link https://date-fns.org/docs/Options}
* @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
* @returns {Date} the new date with the equivalent time in the time zone
* @throws {TypeError} 2 arguments required
* @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2
*
* @example
* // In June 10am UTC is 6am in New York (-04:00)
* const result = utcToZonedTime('2014-06-25T10:00:00.000Z', 'America/New_York')
* //=> Jun 25 2014 06:00:00
*/
export default function utcToZonedTime(dirtyDate, timeZone, options) {
var date = toDate(dirtyDate, options)
var offsetMilliseconds = tzParseTimezone(timeZone, date, true)
var d = new Date(date.getTime() - offsetMilliseconds)
var resultDate = new Date(0)
resultDate.setFullYear(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate())
resultDate.setHours(d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds(), d.getUTCMilliseconds())
return resultDate
}

View File

@@ -0,0 +1,24 @@
// @flow
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.
import type { Locale } from 'date-fns'
type OptionsWithTZ = {
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7,
additionalDigits?: 0 | 1 | 2,
timeZone?: string,
originalDate?: Date | number,
locale?: Locale,
includeSeconds?: boolean,
addSuffix?: boolean,
unit?: 'second' | 'minute' | 'hour' | 'day' | 'month' | 'year',
roundingMethod?: 'floor' | 'ceil' | 'round',
awareOfUnicodeTokens?: boolean,
}
declare module.exports: (
date: Date | string | number,
timeZone: string,
options?: OptionsWithTZ
) => Date

View File

@@ -0,0 +1,5 @@
{
"sideEffects": false,
"type": "module",
"typings": "../../typings.d.ts"
}

View File

@@ -0,0 +1,4 @@
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.
import { zonedTimeToUtc } from 'date-fns-tz'
export = zonedTimeToUtc

View File

@@ -0,0 +1,53 @@
import cloneObject from 'date-fns/_lib/cloneObject/index.js'
import toDate from '../toDate/index.js'
import tzPattern from '../_lib/tzPattern/index.js'
import tzParseTimezone from '../_lib/tzParseTimezone/index.js'
import newDateUTC from '../_lib/newDateUTC/index.js'
/**
* @name zonedTimeToUtc
* @category Time Zone Helpers
* @summary Get the UTC date/time from a date representing local time in a given time zone
*
* @description
* Returns a date instance with the UTC time of the provided date of which the values
* represented the local time in the time zone specified. In other words, if the input
* date represented local time in time time zone, the timestamp of the output date will
* give the equivalent UTC of that local time regardless of the current system time zone.
*
* @param {Date|String|Number} date - the date with values representing the local time
* @param {String} timeZone - the time zone of this local time, can be an offset or IANA time zone
* @param {OptionsWithTZ} [options] - the object with options. See [Options]{@link https://date-fns.org/docs/Options}
* @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
* @returns {Date} the new date with the equivalent time in the time zone
* @throws {TypeError} 2 arguments required
* @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2
*
* @example
* // In June 10am in Los Angeles is 5pm UTC
* const result = zonedTimeToUtc(new Date(2014, 5, 25, 10, 0, 0), 'America/Los_Angeles')
* //=> 2014-06-25T17:00:00.000Z
*/
export default function zonedTimeToUtc(date, timeZone, options) {
if (typeof date === 'string' && !date.match(tzPattern)) {
var extendedOptions = cloneObject(options)
extendedOptions.timeZone = timeZone
return toDate(date, extendedOptions)
}
var d = toDate(date, options)
var utc = newDateUTC(
d.getFullYear(),
d.getMonth(),
d.getDate(),
d.getHours(),
d.getMinutes(),
d.getSeconds(),
d.getMilliseconds()
).getTime()
var offsetMilliseconds = tzParseTimezone(timeZone, new Date(utc))
return new Date(utc + offsetMilliseconds)
}

View File

@@ -0,0 +1,24 @@
// @flow
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.
import type { Locale } from 'date-fns'
type OptionsWithTZ = {
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7,
additionalDigits?: 0 | 1 | 2,
timeZone?: string,
originalDate?: Date | number,
locale?: Locale,
includeSeconds?: boolean,
addSuffix?: boolean,
unit?: 'second' | 'minute' | 'hour' | 'day' | 'month' | 'year',
roundingMethod?: 'floor' | 'ceil' | 'round',
awareOfUnicodeTokens?: boolean,
}
declare module.exports: (
date: Date | string | number,
timeZone: string,
options?: OptionsWithTZ
) => Date

View File

@@ -0,0 +1,5 @@
{
"sideEffects": false,
"type": "module",
"typings": "../../typings.d.ts"
}

View File

@@ -0,0 +1,163 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
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 }; }
var MILLISECONDS_IN_MINUTE = 60 * 1000;
var formatters = {
// Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
X: function (date, token, localize, options) {
var timezoneOffset = getTimeZoneOffset(options.timeZone, date);
if (timezoneOffset === 0) {
return 'Z';
}
switch (token) {
// Hours and optional minutes
case 'X':
return formatTimezoneWithOptionalMinutes(timezoneOffset);
// Hours, minutes and optional seconds without `:` delimeter
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
// so this token always has the same output as `XX`
case 'XXXX':
case 'XX':
// Hours and minutes without `:` delimeter
return formatTimezone(timezoneOffset);
// Hours, minutes and optional seconds with `:` delimeter
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
// so this token always has the same output as `XXX`
case 'XXXXX':
case 'XXX': // Hours and minutes with `:` delimeter
default:
return formatTimezone(timezoneOffset, ':');
}
},
// Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
x: function (date, token, localize, options) {
var timezoneOffset = getTimeZoneOffset(options.timeZone, date);
switch (token) {
// Hours and optional minutes
case 'x':
return formatTimezoneWithOptionalMinutes(timezoneOffset);
// Hours, minutes and optional seconds without `:` delimeter
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
// so this token always has the same output as `xx`
case 'xxxx':
case 'xx':
// Hours and minutes without `:` delimeter
return formatTimezone(timezoneOffset);
// Hours, minutes and optional seconds with `:` delimeter
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
// so this token always has the same output as `xxx`
case 'xxxxx':
case 'xxx': // Hours and minutes with `:` delimeter
default:
return formatTimezone(timezoneOffset, ':');
}
},
// Timezone (GMT)
O: function (date, token, localize, options) {
var timezoneOffset = getTimeZoneOffset(options.timeZone, date);
switch (token) {
// Short
case 'O':
case 'OO':
case 'OOO':
return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
// Long
case 'OOOO':
default:
return 'GMT' + formatTimezone(timezoneOffset, ':');
}
},
// Timezone (specific non-location)
z: function (date, token, localize, options) {
switch (token) {
// Short
case 'z':
case 'zz':
case 'zzz':
return (0, _index.default)('short', date, options);
// Long
case 'zzzz':
default:
return (0, _index.default)('long', date, options);
}
}
};
function getTimeZoneOffset(timeZone, originalDate) {
var timeZoneOffset = timeZone ? (0, _index2.default)(timeZone, originalDate, true) / MILLISECONDS_IN_MINUTE : originalDate.getTimezoneOffset();
if (Number.isNaN(timeZoneOffset)) {
throw new RangeError('Invalid time zone specified: ' + timeZone);
}
return timeZoneOffset;
}
function addLeadingZeros(number, targetLength) {
var sign = number < 0 ? '-' : '';
var output = Math.abs(number).toString();
while (output.length < targetLength) {
output = '0' + output;
}
return sign + output;
}
function formatTimezone(offset, dirtyDelimeter) {
var delimeter = dirtyDelimeter || '';
var sign = offset > 0 ? '-' : '+';
var absOffset = Math.abs(offset);
var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
var minutes = addLeadingZeros(Math.floor(absOffset % 60), 2);
return sign + hours + delimeter + minutes;
}
function formatTimezoneWithOptionalMinutes(offset, dirtyDelimeter) {
if (offset % 60 === 0) {
var sign = offset > 0 ? '-' : '+';
return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
}
return formatTimezone(offset, dirtyDelimeter);
}
function formatTimezoneShort(offset, dirtyDelimiter) {
var sign = offset > 0 ? '-' : '+';
var absOffset = Math.abs(offset);
var hours = Math.floor(absOffset / 60);
var minutes = absOffset % 60;
if (minutes === 0) {
return sign + String(hours);
}
var delimiter = dirtyDelimiter || '';
return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
}
var _default = formatters;
exports.default = _default;
module.exports = exports.default;

4
server/node_modules/date-fns-tz/format/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,4 @@
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.
import { format } from 'date-fns-tz'
export = format

356
server/node_modules/date-fns-tz/format/index.js generated vendored Normal file
View File

@@ -0,0 +1,356 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = format;
var _index = _interopRequireDefault(require("date-fns/format/index.js"));
var _index2 = _interopRequireDefault(require("./formatters/index.js"));
var _index3 = _interopRequireDefault(require("../toDate/index.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var tzFormattingTokensRegExp = /([xXOz]+)|''|'(''|[^'])+('|$)/g;
/**
* @name format
* @category Common Helpers
* @summary Format the date.
*
* @description
* Return the formatted date string in the given format. The result may vary by locale.
*
* > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
* > See: https://git.io/fxCyr
*
* The characters wrapped between two single quotes characters (') are escaped.
* Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
* (see the last example)
*
* Format of the string is based on Unicode Technical Standard #35:
* https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
* with a few additions (see note 7 below the table).
*
* Accepted patterns:
* | Unit | Pattern | Result examples | Notes |
* |---------------------------------|---------|-----------------------------------|-------|
* | Era | G..GGG | AD, BC | |
* | | GGGG | Anno Domini, Before Christ | 2 |
* | | GGGGG | A, B | |
* | Calendar year | y | 44, 1, 1900, 2017 | 5 |
* | | yo | 44th, 1st, 0th, 17th | 5,7 |
* | | yy | 44, 01, 00, 17 | 5 |
* | | yyy | 044, 001, 1900, 2017 | 5 |
* | | yyyy | 0044, 0001, 1900, 2017 | 5 |
* | | yyyyy | ... | 3,5 |
* | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |
* | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |
* | | YY | 44, 01, 00, 17 | 5,8 |
* | | YYY | 044, 001, 1900, 2017 | 5 |
* | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |
* | | YYYYY | ... | 3,5 |
* | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |
* | | RR | -43, 00, 01, 1900, 2017 | 5,7 |
* | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |
* | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |
* | | RRRRR | ... | 3,5,7 |
* | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |
* | | uu | -43, 01, 1900, 2017 | 5 |
* | | uuu | -043, 001, 1900, 2017 | 5 |
* | | uuuu | -0043, 0001, 1900, 2017 | 5 |
* | | uuuuu | ... | 3,5 |
* | Quarter (formatting) | Q | 1, 2, 3, 4 | |
* | | Qo | 1st, 2nd, 3rd, 4th | 7 |
* | | QQ | 01, 02, 03, 04 | |
* | | QQQ | Q1, Q2, Q3, Q4 | |
* | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |
* | | QQQQQ | 1, 2, 3, 4 | 4 |
* | Quarter (stand-alone) | q | 1, 2, 3, 4 | |
* | | qo | 1st, 2nd, 3rd, 4th | 7 |
* | | qq | 01, 02, 03, 04 | |
* | | qqq | Q1, Q2, Q3, Q4 | |
* | | qqqq | 1st quarter, 2nd quarter, ... | 2 |
* | | qqqqq | 1, 2, 3, 4 | 4 |
* | Month (formatting) | M | 1, 2, ..., 12 | |
* | | Mo | 1st, 2nd, ..., 12th | 7 |
* | | MM | 01, 02, ..., 12 | |
* | | MMM | Jan, Feb, ..., Dec | |
* | | MMMM | January, February, ..., December | 2 |
* | | MMMMM | J, F, ..., D | |
* | Month (stand-alone) | L | 1, 2, ..., 12 | |
* | | Lo | 1st, 2nd, ..., 12th | 7 |
* | | LL | 01, 02, ..., 12 | |
* | | LLL | Jan, Feb, ..., Dec | |
* | | LLLL | January, February, ..., December | 2 |
* | | LLLLL | J, F, ..., D | |
* | Local week of year | w | 1, 2, ..., 53 | |
* | | wo | 1st, 2nd, ..., 53th | 7 |
* | | ww | 01, 02, ..., 53 | |
* | ISO week of year | I | 1, 2, ..., 53 | 7 |
* | | Io | 1st, 2nd, ..., 53th | 7 |
* | | II | 01, 02, ..., 53 | 7 |
* | Day of month | d | 1, 2, ..., 31 | |
* | | do | 1st, 2nd, ..., 31st | 7 |
* | | dd | 01, 02, ..., 31 | |
* | Day of year | D | 1, 2, ..., 365, 366 | 8 |
* | | Do | 1st, 2nd, ..., 365th, 366th | 7 |
* | | DD | 01, 02, ..., 365, 366 | 8 |
* | | DDD | 001, 002, ..., 365, 366 | |
* | | DDDD | ... | 3 |
* | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Su | |
* | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
* | | EEEEE | M, T, W, T, F, S, S | |
* | | EEEEEE | Mo, Tu, We, Th, Fr, Su, Sa | |
* | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |
* | | io | 1st, 2nd, ..., 7th | 7 |
* | | ii | 01, 02, ..., 07 | 7 |
* | | iii | Mon, Tue, Wed, ..., Su | 7 |
* | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |
* | | iiiii | M, T, W, T, F, S, S | 7 |
* | | iiiiii | Mo, Tu, We, Th, Fr, Su, Sa | 7 |
* | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |
* | | eo | 2nd, 3rd, ..., 1st | 7 |
* | | ee | 02, 03, ..., 01 | |
* | | eee | Mon, Tue, Wed, ..., Su | |
* | | eeee | Monday, Tuesday, ..., Sunday | 2 |
* | | eeeee | M, T, W, T, F, S, S | |
* | | eeeeee | Mo, Tu, We, Th, Fr, Su, Sa | |
* | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |
* | | co | 2nd, 3rd, ..., 1st | 7 |
* | | cc | 02, 03, ..., 01 | |
* | | ccc | Mon, Tue, Wed, ..., Su | |
* | | cccc | Monday, Tuesday, ..., Sunday | 2 |
* | | ccccc | M, T, W, T, F, S, S | |
* | | cccccc | Mo, Tu, We, Th, Fr, Su, Sa | |
* | AM, PM | a..aaa | AM, PM | |
* | | aaaa | a.m., p.m. | 2 |
* | | aaaaa | a, p | |
* | AM, PM, noon, midnight | b..bbb | AM, PM, noon, midnight | |
* | | bbbb | a.m., p.m., noon, midnight | 2 |
* | | bbbbb | a, p, n, mi | |
* | Flexible day period | B..BBB | at night, in the morning, ... | |
* | | BBBB | at night, in the morning, ... | 2 |
* | | BBBBB | at night, in the morning, ... | |
* | Hour [1-12] | h | 1, 2, ..., 11, 12 | |
* | | ho | 1st, 2nd, ..., 11th, 12th | 7 |
* | | hh | 01, 02, ..., 11, 12 | |
* | Hour [0-23] | H | 0, 1, 2, ..., 23 | |
* | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |
* | | HH | 00, 01, 02, ..., 23 | |
* | Hour [0-11] | K | 1, 2, ..., 11, 0 | |
* | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |
* | | KK | 1, 2, ..., 11, 0 | |
* | Hour [1-24] | k | 24, 1, 2, ..., 23 | |
* | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |
* | | kk | 24, 01, 02, ..., 23 | |
* | Minute | m | 0, 1, ..., 59 | |
* | | mo | 0th, 1st, ..., 59th | 7 |
* | | mm | 00, 01, ..., 59 | |
* | Second | s | 0, 1, ..., 59 | |
* | | so | 0th, 1st, ..., 59th | 7 |
* | | ss | 00, 01, ..., 59 | |
* | Fraction of second | S | 0, 1, ..., 9 | |
* | | SS | 00, 01, ..., 99 | |
* | | SSS | 000, 0001, ..., 999 | |
* | | SSSS | ... | 3 |
* | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |
* | | XX | -0800, +0530, Z | |
* | | XXX | -08:00, +05:30, Z | |
* | | XXXX | -0800, +0530, Z, +123456 | 2 |
* | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |
* | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |
* | | xx | -0800, +0530, +0000 | |
* | | xxx | -08:00, +05:30, +00:00 | 2 |
* | | xxxx | -0800, +0530, +0000, +123456 | |
* | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |
* | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |
* | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |
* | Timezone (specific non-locat.) | z...zzz | PDT, EST, CEST | 6 |
* | | zzzz | Pacific Daylight Time | 2,6 |
* | Seconds timestamp | t | 512969520 | 7 |
* | | tt | ... | 3,7 |
* | Milliseconds timestamp | T | 512969520900 | 7 |
* | | TT | ... | 3,7 |
* | Long localized date | P | 05/29/1453 | 7 |
* | | PP | May 29, 1453 | 7 |
* | | PPP | May 29th, 1453 | 7 |
* | | PPPP | Sunday, May 29th, 1453 | 2,7 |
* | Long localized time | p | 12:00 AM | 7 |
* | | pp | 12:00:00 AM | 7 |
* | | ppp | 12:00:00 AM GMT+2 | 7 |
* | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |
* | Combination of date and time | Pp | 05/29/1453, 12:00 AM | 7 |
* | | PPpp | May 29, 1453, 12:00:00 AM | 7 |
* | | PPPppp | May 29th, 1453 at ... | 7 |
* | | PPPPpppp| Sunday, May 29th, 1453 at ... | 2,7 |
* Notes:
* 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
* are the same as "stand-alone" units, but are different in some languages.
* "Formatting" units are declined according to the rules of the language
* in the context of a date. "Stand-alone" units are always nominative singular:
*
* `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`
*
* `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`
*
* 2. Any sequence of the identical letters is a pattern, unless it is escaped by
* the single quote characters (see below).
* If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)
* the output will be the same as default pattern for this unit, usually
* the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units
* are marked with "2" in the last column of the table.
*
* `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`
*
* `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`
*
* `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`
*
* `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`
*
* `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`
*
* 3. Some patterns could be unlimited length (such as `yyyyyyyy`).
* The output will be padded with zeros to match the length of the pattern.
*
* `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`
*
* 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.
* These tokens represent the shortest form of the quarter.
*
* 5. The main difference between `y` and `u` patterns are B.C. years:
*
* | Year | `y` | `u` |
* |------|-----|-----|
* | AC 1 | 1 | 1 |
* | BC 1 | 1 | 0 |
* | BC 2 | 2 | -1 |
*
* Also `yy` always returns the last two digits of a year,
* while `uu` pads single digit years to 2 characters and returns other years unchanged:
*
* | Year | `yy` | `uu` |
* |------|------|------|
* | 1 | 01 | 01 |
* | 14 | 14 | 14 |
* | 376 | 76 | 376 |
* | 1453 | 53 | 1453 |
*
* The same difference is true for local and ISO week-numbering years (`Y` and `R`),
* except local week-numbering years are dependent on `options.weekStartsOn`
* and `options.firstWeekContainsDate` (compare [getISOWeekYear]{@link https://date-fns.org/docs/getISOWeekYear}
* and [getWeekYear]{@link https://date-fns.org/docs/getWeekYear}).
*
* 6. Specific non-location timezones are created using the Intl browser API. The output is determined by the
* preferred standard of the current locale (en-US by default) which may not always give the expected result.
* For this reason it is recommended to supply a `locale` in the format options when formatting a time zone name.
*
* 7. These patterns are not in the Unicode Technical Standard #35:
* - `i`: ISO day of week
* - `I`: ISO week of year
* - `R`: ISO week-numbering year
* - `t`: seconds timestamp
* - `T`: milliseconds timestamp
* - `o`: ordinal number modifier
* - `P`: long localized date
* - `p`: long localized time
*
* 8. These tokens are often confused with others. See: https://git.io/fxCyr
*
*
* ### v2.0.0 breaking changes:
*
* - [Changes that are common for the whole
* library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
*
* - The second argument is now required for the sake of explicitness.
*
* ```javascript
* // Before v2.0.0
* format(new Date(2016, 0, 1))
*
* // v2.0.0 onward
* format(new Date(2016, 0, 1), "yyyy-MM-dd'T'HH:mm:ss.SSSxxx")
* ```
*
* - New format string API for `format` function
* which is based on [Unicode Technical Standard
* #35](https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table). See [this
* post](https://blog.date-fns.org/post/unicode-tokens-in-date-fns-v2-sreatyki91jg) for more details.
*
* - Characters are now escaped using single quote symbols (`'`) instead of square brackets.
*
* @param {Date|Number} date - the original date
* @param {String} format - the string of tokens
* @param {OptionsWithTZ} [options] - the object with options. See [Options]{@link https://date-fns.org/docs/Options}
* @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link
* https://date-fns.org/docs/toDate}
* @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
* @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is
* @param {Locale} [options.locale=defaultLocale] - the locale object. See
* [Locale]{@link https://date-fns.org/docs/Locale}
* @param {Boolean} [options.awareOfUnicodeTokens=false] - if true, allows usage of Unicode tokens causes confusion:
* - Some of the day of year tokens (`D`, `DD`) that are confused with the day of month tokens (`d`, `dd`).
* - Some of the local week-numbering year tokens (`YY`, `YYYY`) that are confused with the calendar year tokens
* (`yy`, `yyyy`). See: https://git.io/fxCyr
* @param {String} [options.timeZone=''] - used to specify the IANA time zone offset of a date String.
* @param {Date|Number} [options.originalDate] - can be used to pass the original unmodified date to `format` to
* improve correctness of the replaced timezone token close to the DST threshold.
* @returns {String} the formatted date string
* @throws {TypeError} 2 arguments required
* @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2
* @throws {RangeError} `options.locale` must contain `localize` property
* @throws {RangeError} `options.locale` must contain `formatLong` property
* @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
* @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7
* @throws {RangeError} `options.awareOfUnicodeTokens` must be set to `true` to use `XX` token; see:
* https://git.io/fxCyr
*
* @example
* // Represent 11 February 2014 in middle-endian format:
* var result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
* //=> '02/11/2014'
*
* @example
* // Represent 2 July 2014 in Esperanto:
* import { eoLocale } from 'date-fns/locale/eo'
* var result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
* locale: eoLocale
* })
* //=> '2-a de julio 2014'
*
* @example
* // Escape string by single quote characters:
* var result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
* //=> "3 o'clock"
*/
function format(dirtyDate, dirtyFormatStr, dirtyOptions) {
var formatStr = String(dirtyFormatStr);
var options = dirtyOptions || {};
var matches = formatStr.match(tzFormattingTokensRegExp);
if (matches) {
var date = (0, _index3.default)(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] === "'") {
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, "'" + _index2.default[token[0]](date, token, null, options) + "'"); // If the replacement results in two adjoining quoted strings, the back to back quotes
// are removed, so it doesn't look like an escaped quote.
return precededByQuotedSection ? replaced.substring(0, pos - 1) + replaced.substring(pos + 1) : replaced;
}, formatStr);
}
return (0, _index.default)(dirtyDate, formatStr, options);
}
module.exports = exports.default;

20
server/node_modules/date-fns-tz/format/index.js.flow generated vendored Normal file
View File

@@ -0,0 +1,20 @@
// @flow
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.
import type { Locale } from 'date-fns'
type OptionsWithTZ = {
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7,
additionalDigits?: 0 | 1 | 2,
timeZone?: string,
originalDate?: Date | number,
locale?: Locale,
includeSeconds?: boolean,
addSuffix?: boolean,
unit?: 'second' | 'minute' | 'hour' | 'day' | 'month' | 'year',
roundingMethod?: 'floor' | 'ceil' | 'round',
awareOfUnicodeTokens?: boolean,
}
declare module.exports: (date: Date | number, format: string, options?: OptionsWithTZ) => string

6
server/node_modules/date-fns-tz/format/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"sideEffects": false,
"type": "commonjs",
"module": "../esm/format/index.js",
"typings": "../typings.d.ts"
}

View File

@@ -0,0 +1,4 @@
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.
import { formatInTimeZone } from 'date-fns-tz'
export = formatInTimeZone

View File

@@ -0,0 +1,45 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = formatInTimeZone;
var _index = _interopRequireDefault(require("date-fns/_lib/cloneObject/index.js"));
var _index2 = _interopRequireDefault(require("../format/index.js"));
var _index3 = _interopRequireDefault(require("../utcToZonedTime/index.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* @name formatInTimeZone
* @category Time Zone Helpers
* @summary Gets the offset in milliseconds between the time zone and Universal Coordinated Time (UTC)
*
* @param {Date|String|Number} date - the date representing the local time / real UTC time
* @param {String} timeZone - the time zone this date should be formatted for; can be an offset or IANA time zone
* @param {String} formatStr - the string of tokens
* @param {OptionsWithTZ} [options] - the object with options. See [Options]{@link https://date-fns.org/docs/Options}
* @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link
* https://date-fns.org/docs/toDate}
* @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
* @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is
* @param {Locale} [options.locale=defaultLocale] - the locale object. See
* [Locale]{@link https://date-fns.org/docs/Locale}
* @param {Boolean} [options.awareOfUnicodeTokens=false] - if true, allows usage of Unicode tokens causes confusion:
* - Some of the day of year tokens (`D`, `DD`) that are confused with the day of month tokens (`d`, `dd`).
* - Some of the local week-numbering year tokens (`YY`, `YYYY`) that are confused with the calendar year tokens
* (`yy`, `yyyy`). See: https://git.io/fxCyr
* @param {String} [options.timeZone=''] - used to specify the IANA time zone offset of a date String.
* @returns {String} the formatted date string
*/
function formatInTimeZone(date, timeZone, formatStr, options) {
var extendedOptions = (0, _index.default)(options);
extendedOptions.timeZone = timeZone;
extendedOptions.originalDate = date;
return (0, _index2.default)((0, _index3.default)(date, timeZone), formatStr, extendedOptions);
}
module.exports = exports.default;

View File

@@ -0,0 +1,25 @@
// @flow
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.
import type { Locale } from 'date-fns'
type OptionsWithTZ = {
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7,
additionalDigits?: 0 | 1 | 2,
timeZone?: string,
originalDate?: Date | number,
locale?: Locale,
includeSeconds?: boolean,
addSuffix?: boolean,
unit?: 'second' | 'minute' | 'hour' | 'day' | 'month' | 'year',
roundingMethod?: 'floor' | 'ceil' | 'round',
awareOfUnicodeTokens?: boolean,
}
declare module.exports: (
date: Date | string | number,
timeZone: string,
formatStr: string,
options?: OptionsWithTZ
) => string

View File

@@ -0,0 +1,6 @@
{
"sideEffects": false,
"type": "commonjs",
"module": "../esm/formatInTimeZone/index.js",
"typings": "../typings.d.ts"
}

4
server/node_modules/date-fns-tz/fp/format/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,4 @@
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.
import { format } from 'date-fns-tz/fp'
export = format

18
server/node_modules/date-fns-tz/fp/format/index.js generated vendored Normal file
View File

@@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _index = _interopRequireDefault(require("../../format/index.js"));
var _index2 = _interopRequireDefault(require("date-fns/fp/_lib/convertToFP/index.js"));
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, _index2.default)(_index.default, 2);
var _default = format;
exports.default = _default;
module.exports = exports.default;

Some files were not shown because too many files have changed in this diff Show More