Comparing version 0.2.12 to 0.3.0
@@ -1,1 +0,1 @@ | ||
This contains Luxon's tiny website. Use `gulp site` command to copy it to the build directory. | ||
This contains Luxon's tiny website. Use `npm run site` command to copy it to the build directory. |
# Changelog | ||
## 0.3.0 | ||
* Rename DateTime.fromString to DateTime.fromFormat (leaving deprecated DateTime.fromString) | ||
* Rename DateTime.fromStringExplain to DateTime.fromFormatExplain (leaving deprecated DateTime.fromStringExplain) | ||
* Support Etc/GMT IANA zones | ||
* Perf fixes for zones | ||
* Rework build infrastructure | ||
## 0.2.12 | ||
* Fix DateTime.fromObject's handling of default zones | ||
* Change `keepCalendarTime` to `keepLocalTime` | ||
@@ -7,0 +16,0 @@ ## 0.2.11 |
{ | ||
"name": "luxon", | ||
"version": "0.2.12", | ||
"version": "0.3.0", | ||
"description": "Immutable date wrapper", | ||
"author": "Isaac Cambron", | ||
"keywords": ["date", "immutable"], | ||
"keywords": [ | ||
"date", | ||
"immutable" | ||
], | ||
"repository": "https://github.com/moment/luxon", | ||
"dependencies": {}, | ||
"scripts": { | ||
"precommit": "lint-staged" | ||
"build": "babel-node tasks/build.js", | ||
"test": "babel-node tasks/unit.js", | ||
"docs": "esdoc -c docs/index.js", | ||
"site": "cp -r site/** build/", | ||
"lint": "eslint src/**/*.js, test/**/*.js, benchmarks/*.js", | ||
"lint!": "npm run format && npm run lint", | ||
"format": "prettier --config .prettier.js --write **.js", | ||
"benchmark": "babel-node benchmarks/datetime.js", | ||
"coveralls": "cat build/coverage/lcov.info | coveralls", | ||
"check-doc-coverage": "babel-node tasks/docCoverage" | ||
}, | ||
"lint-staged": { | ||
"*.{js,json}": ["prettier --config .prettier.js --write", "git add"] | ||
"*.{js,json}": [ | ||
"prettier --config .prettier.js --write", | ||
"git add" | ||
] | ||
}, | ||
"devDependencies": { | ||
"babel-jest": "latest", | ||
"babel-cli": "latest", | ||
"babel-plugin-external-helpers": "latest", | ||
@@ -22,5 +38,5 @@ "babel-preset-env": "latest", | ||
"coveralls": "latest", | ||
"del": "3.0.0", | ||
"esdoc": "latest", | ||
"esdoc-standard-plugin": "latest", | ||
"eslint": "^4.12.0", | ||
"eslint": "^4.14.0", | ||
"eslint-config-airbnb-base": "12.0.2", | ||
@@ -30,20 +46,6 @@ "eslint-config-prettier": "^2.9.0", | ||
"eslint-plugin-prettier": "latest", | ||
"gulp": "latest", | ||
"gulp-babel": "7.0.0", | ||
"gulp-babel-minify": "latest", | ||
"gulp-bench": "latest", | ||
"gulp-benchmark": "1.1.1", | ||
"gulp-coveralls": "latest", | ||
"gulp-esdoc": "icambron/gulp-esdoc#latest-esdoc", | ||
"gulp-eslint": "latest", | ||
"gulp-filter": "latest", | ||
"gulp-jest": "2.0.0", | ||
"gulp-rename": "latest", | ||
"gulp-sourcemaps": "latest", | ||
"gulp-uglify": "latest", | ||
"gulp-util": "latest", | ||
"fs-extra": "latest", | ||
"husky": "^0.14.3", | ||
"jest": "^21.2.1", | ||
"jest-cli": "latest", | ||
"lazypipe": "latest", | ||
"lint-staged": "^4.3.0", | ||
@@ -53,9 +55,5 @@ "prettier": "1.7.4", | ||
"rollup-plugin-commonjs": "latest", | ||
"rollup-plugin-babel-minify": "latest", | ||
"rollup-plugin-node-resolve": "latest", | ||
"rollup-stream": "latest", | ||
"run-sequence": "latest", | ||
"tap-min": "latest", | ||
"through2": "latest", | ||
"vinyl-buffer": "latest", | ||
"vinyl-source-stream": "latest" | ||
"rollup": "latest" | ||
}, | ||
@@ -62,0 +60,0 @@ "main": "build/node/luxon.js", |
@@ -183,2 +183,3 @@ import { Duration } from '../duration'; | ||
static normalizeZone(input) { | ||
let offset; | ||
if (Util.isUndefined(input) || input === null) { | ||
@@ -192,3 +193,6 @@ return Settings.defaultZone; | ||
else if (lowered === 'utc') return FixedOffsetZone.utcInstance; | ||
else if (IANAZone.isValidSpecier(lowered)) return new IANAZone(input); | ||
else if ((offset = IANAZone.parseGMTOffset(input)) != null) { | ||
// handle Etc/GMT-4, which V8 chokes on | ||
return FixedOffsetZone.instance(offset); | ||
} else if (IANAZone.isValidSpecier(lowered)) return new IANAZone(input); | ||
else return FixedOffsetZone.parseSpecifier(lowered) || Settings.defaultZone; | ||
@@ -195,0 +199,0 @@ } else if (Util.isNumber(input)) { |
@@ -129,6 +129,6 @@ import { DateTime } from './datetime'; | ||
* Keys: | ||
* * `timezones`: whether this environment supports IANA timezones | ||
* * `zones`: whether this environment supports IANA timezones | ||
* * `intlTokens`: whether this environment supports internationalized token-based formatting/parsing | ||
* * `intl`: whether this environment supports general internationalization | ||
* @example Info.feature() //=> { intl: true, intlTokens: false, timezones: true } | ||
* @example Info.features() //=> { intl: true, intlTokens: false, zones: true } | ||
* @return {object} | ||
@@ -135,0 +135,0 @@ */ |
@@ -339,2 +339,3 @@ import { Util } from './impl/util'; | ||
* Specifically, the resulting Interval has the maximum start time and the minimum end time of the two Intervals. | ||
* Returns null if the intersection is empty, i.e., the intervals don't intersect. | ||
* @param {Interval} other | ||
@@ -341,0 +342,0 @@ * @return {Interval} |
import { Util } from '../impl/util'; | ||
import { Zone } from '../zone'; | ||
const dtfCache = {}; | ||
function makeDTF(zone) { | ||
if (!dtfCache[zone]) { | ||
dtfCache[zone] = new Intl.DateTimeFormat('en-US', { | ||
hour12: false, | ||
timeZone: zone, | ||
year: 'numeric', | ||
month: '2-digit', | ||
day: '2-digit', | ||
hour: '2-digit', | ||
minute: '2-digit', | ||
second: '2-digit' | ||
}); | ||
} | ||
return dtfCache[zone]; | ||
} | ||
const typeToPos = { | ||
@@ -49,5 +66,16 @@ year: 0, | ||
static isValidSpecier(s) { | ||
return s && s.match(/[a-z_]{1,256}\/[a-z_]{1,256}/i); | ||
return s && s.match(/^[a-z_+-]{1,256}\/[a-z_+-]{1,256}$/i); | ||
} | ||
// Etc/GMT+8 -> 480 | ||
static parseGMTOffset(specifier) { | ||
if (specifier) { | ||
const match = specifier.match(/^Etc\/GMT([+-]\d{1,2})$/i); | ||
if (match) { | ||
return 60 * parseInt(match[1]); | ||
} | ||
} | ||
return null; | ||
} | ||
constructor(name) { | ||
@@ -77,12 +105,3 @@ super(); | ||
const date = new Date(ts), | ||
dtf = new Intl.DateTimeFormat('en-US', { | ||
hour12: false, | ||
timeZone: this.zoneName, | ||
year: 'numeric', | ||
month: '2-digit', | ||
day: '2-digit', | ||
hour: '2-digit', | ||
minute: '2-digit', | ||
second: '2-digit' | ||
}), | ||
dtf = makeDTF(this.zoneName), | ||
[fYear, fMonth, fDay, fHour, fMinute, fSecond] = dtf.formatToParts | ||
@@ -89,0 +108,0 @@ ? partsOffset(dtf, date) |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25
1186779
16214