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

js-joda

Package Overview
Dependencies
Maintainers
2
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js-joda - npm Package Compare versions

Comparing version 1.1.17 to 1.2.0

yarn.lock

2

bower.json

@@ -18,6 +18,4 @@ {

"node_modules",
"dist",
"src",
"test"
]
}
Changelog
=========
### 1.1.18 (next)
### 1.2.1 (next)
### 1.2.0
#### iana tzdb
* Complete parsing of ZoneRegions
#### etc
* Fix bower.json
* Fix LocalTime.parse esdoc/ typescript definition
#### dependency updates
### 1.1.17

@@ -13,3 +26,3 @@

#### ianna tzdb
#### iana tzdb

@@ -16,0 +29,0 @@ * First quick approach for parsing ZoneRegions

@@ -396,3 +396,3 @@ declare namespace JSJoda {

static parse(text: String, formatter?: String): LocalTime
static parse(text: String, formatter?: DateTimeFormatter): LocalTime

@@ -399,0 +399,0 @@ constructor(hour?: number, minute?: number, second?: number, nanoOfSecond?: number)

{
"name": "js-joda",
"version": "1.1.17",
"version": "1.2.0",
"description": "a date and time library for javascript",

@@ -38,15 +38,15 @@ "repository": {

"devDependencies": {
"babel-cli": "^6.18.0",
"babel-core": "^6.18.2",
"babel-loader": "^6.2.7",
"babel-plugin-istanbul": "^3.0.0",
"babel-preset-es2015": "^6.18.0",
"babel-cli": "^6.22.2",
"babel-core": "^6.22.1",
"babel-loader": "^6.2.10",
"babel-plugin-istanbul": "^3.1.2",
"babel-preset-es2015": "^6.22.0",
"chai": "^3.5.0",
"coveralls": "^2.11.15",
"esdoc": "^0.4.8",
"eslint": "^3.10.1",
"esdoc": "^0.5.2",
"eslint": "^3.13.1",
"eslint-config-standard": "^6.2.1",
"eslint-plugin-promise": "^3.3.2",
"eslint-plugin-promise": "^3.4.0",
"eslint-plugin-standard": "^2.0.1",
"karma": "^1.3.0",
"karma": "^1.4.0",
"karma-chai-plugins": "^0.8.0",

@@ -59,11 +59,11 @@ "karma-chrome-launcher": "^2.0.0",

"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^1.8.0",
"markdown-toc": "^0.13.0",
"mocha": "^3.1.2",
"nyc": "^10.0.0",
"phantomjs-prebuilt": "^2.1.13",
"typescript": "^2.0.9",
"webpack": "^1.13.3"
"karma-webpack": "^2.0.1",
"markdown-toc": "^1.1.0",
"mocha": "^3.2.0",
"nyc": "^10.1.2",
"phantomjs-prebuilt": "^2.1.14",
"typescript": "^2.1.5",
"webpack": "^1.14.0"
},
"license": "BSD-3-Clause"
}

@@ -106,16 +106,16 @@ Immutable date and time library for javascript

### Milestone 1
### Milestone 1 core domains (reached with version v1.0.0)
We reached milestone 1 with version v1.0.0 supporting the domain models LocalDate, LocalDateTime, ZonedDateTime, Instant, Duration
Support for the domain models LocalDate, LocalDateTime, ZonedDateTime, Instant, Duration
and Period converting from and to ISO8601. ZonedDateTime (without support for loading iana time-zone databases) currently supports
only fixed offsets like UTC or UTC+02:00 and the system default time zone.
### Milestone 2
### Milestone 2 iana timezone support (reached with version v1.2.0)
Add iana timezone database support to js-joda.
Add iana timezone database support to js-joda. Implement handling of Daylight saving transitions mainly in ZonedDateTime.
Implement handling of Daylight saving transitions where missing, mainly in ZonedDateTime. Provide ianna tzdb files that
can be loaded dynamically. Probably we will use the iana tzdb files from moment-timezone.
For having acces to the the iana timezone database, a plugin with an implementation of the `ZoneRulesProvider` is required.
Find a first beta version at [js-joda-timezone](https://github.com/js-joda/js-joda-timezone) that is based on the moment timezone database.
### Milestone 3
### Milestone 3 locale support

@@ -122,0 +122,0 @@ Add locale support.

@@ -113,20 +113,24 @@ /**

// FIXME not efficient but works, replace by subtree approach see threeten
// will fail if a zoneId starts with the same substring of another zoneId
const availableZoneIds = ZoneRulesProvider.getAvailableZoneIds();
if (zoneIdMap.size !== availableZoneIds.length) {
zoneIdMap = new ZoneIdMap(availableZoneIds);
if (zoneIdTree.size !== availableZoneIds.length) {
zoneIdTree = ZoneIdTree.createTreeMap(availableZoneIds);
}
let parseLength = zoneIdMap.minLength;
const maxParseLength = Math.min(zoneIdMap.maxLength, length - position);
while(parseLength <= maxParseLength) {
const parsedZoneId = text.substr(position, parseLength);
if(zoneIdMap.zoneIdMap[parsedZoneId] === true){
context.setParsedZone(ZoneRegion.ofId(parsedZoneId));
return position + parseLength;
const maxParseLength = length - position;
let treeMap = zoneIdTree.treeMap;
let parsedZoneId = null;
let parseLength = 0;
while(treeMap != null) {
const parsedSubZoneId = text.substr(position, Math.min(treeMap.length, maxParseLength));
treeMap = treeMap.get(parsedSubZoneId);
if (treeMap != null && treeMap.isLeaf) {
parsedZoneId = parsedSubZoneId;
parseLength = treeMap.length;
}
parseLength += 1;
}
if (parsedZoneId != null) {
context.setParsedZone(ZoneRegion.ofId(parsedZoneId));
return position + parseLength;
}
// ...
return ~position;

@@ -170,35 +174,46 @@ }

class ZoneIdMap {
constructor(availableZoneIds){
this.size = availableZoneIds.length;
this.minLength = 0;
this.maxLength = 0;
this.zoneIdMap = this._createMap(availableZoneIds);
}
class ZoneIdTree {
_createMap(availableZoneIds) {
const map = {};
for(let i = 0; i < availableZoneIds.length; i++){
const zoneId = availableZoneIds[i];
map[zoneId] = true;
this._setMinMax(zoneId);
static createTreeMap(availableZoneIds) {
const sortedZoneIds = availableZoneIds.sort((a, b) => a.length - b.length);
const treeMap = new ZoneIdTreeMap(sortedZoneIds[0].length, false);
for (let i=0; i<sortedZoneIds.length; i++){
treeMap.add(sortedZoneIds[i]);
}
return map;
return new ZoneIdTree(sortedZoneIds.length, treeMap);
}
_setMinMax(zoneId) {
if(zoneId == null) {
return;
constructor(size, treeMap) {
this.size = size;
this.treeMap = treeMap;
}
}
class ZoneIdTreeMap {
constructor(length = 0, isLeaf = false){
this.length = length;
this.isLeaf = isLeaf;
this._treeMap = {};
}
add(zoneId){
const idLength = zoneId.length;
if(idLength === this.length) {
this._treeMap[zoneId] = new ZoneIdTreeMap(idLength, true);
} else if (idLength > this.length) {
const subZoneId = zoneId.substr(0, this.length);
let subTreeMap = this._treeMap[subZoneId];
if (subTreeMap == null) {
subTreeMap = new ZoneIdTreeMap(idLength, false);
this._treeMap[subZoneId] = subTreeMap;
}
subTreeMap.add(zoneId);
}
if (this.minLength === 0) {
this.minLength = zoneId.length;
this.maxLength = zoneId.length;
} else {
this.minLength = Math.min(this.minLength, zoneId.length);
this.maxLength = Math.max(this.maxLength, zoneId.length);
}
}
get(zoneId){
return this._treeMap[zoneId];
}
}
let zoneIdMap = new ZoneIdMap([]);
let zoneIdTree = new ZoneIdTree([]);

@@ -257,3 +257,4 @@ /**

* @param {!String} text - the text to parse, not null
* @param {!String} formatter - the formatter to use, not null
* @param {DateTimeFormatter} [formatter=DateTimeFormatter.ISO_LOCAL_TIME] - the formatter to use, default is
* {@link DateTimeFormatter.ISO_LOCAL_TIME}
* @return {LocalTime} the parsed local time, not null

@@ -260,0 +261,0 @@ * @throws {DateTimeParseException} if the text cannot be parsed

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc