Socket
Socket
Sign inDemoInstall

js-joda

Package Overview
Dependencies
Maintainers
1
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.0 to 1.1.1

6

CheatSheet.md

@@ -924,7 +924,3 @@ js-joda Cheat sheet

// build a custom date time formatter where the time field is optional
var OPTIONAL_FORMATTER = new DateTimeFormatterBuilder().parseCaseInsensitive()
.append(DateTimeFormatter.ISO_LOCAL_DATE)
.optionalStart()
.appendLiteral('T').append(DateTimeFormatter.ISO_LOCAL_TIME)
.toFormatter();
var OPTIONAL_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd['T'HH:mm:ss]")

@@ -931,0 +927,0 @@ // create a temporal query that create a new Temporal depending on the existing fields

2

package.json
{
"name": "js-joda",
"version": "1.1.0",
"version": "1.1.1",
"description": "a date and time library for javascript",

@@ -5,0 +5,0 @@ "repository": {

@@ -7,4 +7,7 @@ /*

import {requireNonNull, requireInstance} from '../assert';
import {ChronoField} from '../temporal/ChronoField';
import {ChronoUnit} from '../temporal/ChronoUnit';
import {DateTimeFormatter} from '../format/DateTimeFormatter';
import {TemporalQueries} from '../temporal/TemporalQueries';

@@ -204,2 +207,21 @@ import {Temporal} from '../temporal/Temporal';

}
/**
* Formats this date using the specified formatter.
* <p>
* This date will be passed to the formatter to produce a string.
* <p>
* The default implementation must behave as follows:
* <pre>
* return formatter.format(this);
* </pre>
*
* @param {DateTimeFormatter} formatter the formatter to use, not null
* @return {String} the formatted date string, not null
* @throws DateTimeException if an error occurs during printing
*/
format(formatter) {
requireNonNull(formatter, 'formatter');
requireInstance(formatter, DateTimeFormatter, 'formatter');
return formatter.format(this);
}
}

@@ -8,2 +8,5 @@ /**

import {Enum} from '../Enum';
import {requireNonNull} from '../assert';
import {DateTimeException} from '../errors';
import {MathUtil} from '../MathUtil';

@@ -41,2 +44,21 @@ import {LocalDate} from '../LocalDate';

/**
* Updates the map of field-values during resolution.
*
* @param {EnumMap} fieldValues the fieldValues map to update, not null
* @param {ChronoField} field the field to update, not null
* @param {number} value the value to update, not null
* @throws DateTimeException if a conflict occurs
*/
_updateResolveMap(fieldValues, field, value) {
// TODO: this function is in Chronology in threetenbp, maybe needs to be moved?
requireNonNull(fieldValues, 'fieldValues');
requireNonNull(field, 'field');
let current = fieldValues.get(field);
if (current != null && current !== value) {
throw new DateTimeException('Invalid state, field: ' + field + ' ' + current + ' conflicts with ' + field + ' ' + value);
}
fieldValues.put(field, value);
}
resolveDate(fieldValues, resolverStyle) {

@@ -60,34 +82,32 @@ if (fieldValues.containsKey(ChronoField.EPOCH_DAY)) {

// eras
/*
Long yoeLong = fieldValues.remove(YEAR_OF_ERA);
let yoeLong = fieldValues.remove(ChronoField.YEAR_OF_ERA);
if (yoeLong != null) {
if (resolverStyle != ResolverStyle.LENIENT) {
YEAR_OF_ERA.checkValidValue(yoeLong);
if (resolverStyle !== ResolverStyle.LENIENT) {
ChronoField.YEAR_OF_ERA.checkValidValue(yoeLong);
}
Long era = fieldValues.remove(ERA);
let era = fieldValues.remove(ChronoField.ERA);
if (era == null) {
Long year = fieldValues.get(ChronoField.YEAR);
if (resolverStyle == ResolverStyle.STRICT) {
let year = fieldValues.get(ChronoField.YEAR);
if (resolverStyle === ResolverStyle.STRICT) {
// do not invent era if strict, but do cross-check with year
if (year != null) {
updateResolveMap(fieldValues, ChronoField.YEAR, (year > 0 ? yoeLong: Jdk8Methods.safeSubtract(1, yoeLong)));
this._updateResolveMap(fieldValues, ChronoField.YEAR, (year > 0 ? yoeLong: MathUtil.safeSubtract(1, yoeLong)));
} else {
// reinstate the field removed earlier, no cross-check issues
fieldValues.put(YEAR_OF_ERA, yoeLong);
fieldValues.put(ChronoField.YEAR_OF_ERA, yoeLong);
}
} else {
// invent era
updateResolveMap(fieldValues, ChronoField.YEAR, (year == null || year > 0 ? yoeLong: Jdk8Methods.safeSubtract(1, yoeLong)));
this._updateResolveMap(fieldValues, ChronoField.YEAR, (year == null || year > 0 ? yoeLong: MathUtil.safeSubtract(1, yoeLong)));
}
} else if (era.longValue() == 1L) {
updateResolveMap(fieldValues, ChronoField.YEAR, yoeLong);
} else if (era.longValue() == 0L) {
updateResolveMap(fieldValues, ChronoField.YEAR, Jdk8Methods.safeSubtract(1, yoeLong));
} else if (era === 1) {
this._updateResolveMap(fieldValues, ChronoField.YEAR, yoeLong);
} else if (era === 0) {
this._updateResolveMap(fieldValues, ChronoField.YEAR, MathUtil.safeSubtract(1, yoeLong));
} else {
throw new DateTimeException("Invalid value for era: " + era);
throw new DateTimeException('Invalid value for era: ' + era);
}
} else if (fieldValues.containsKey(ERA)) {
ERA.checkValidValue(fieldValues.get(ERA)); // always validated
} else if (fieldValues.containsKey(ChronoField.ERA)) {
ChronoField.ERA.checkValidValue(fieldValues.get(ChronoField.ERA)); // always validated
}
*/

@@ -94,0 +114,0 @@ // build 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 too big to display

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