darkskyapi-ts
Advanced tools
Comparing version 1.0.3 to 1.0.4
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var format_1 = require("date-fns/format"); | ||
var is_date_1 = require("date-fns/is_date"); | ||
var is_valid_1 = require("date-fns/is_valid"); | ||
var parse_1 = require("date-fns/parse"); | ||
var isDate_1 = require("date-fns/isDate"); | ||
var isValid_1 = require("date-fns/isValid"); | ||
var parseISO_1 = require("date-fns/parseISO"); | ||
var errors_1 = require("./errors"); | ||
@@ -11,3 +11,3 @@ /** | ||
*/ | ||
exports.DARKSKY_DATE_FORMAT = 'YYYY-MM-DDTHH:mm:ssZZ'; | ||
exports.DARKSKY_DATE_FORMAT = 'yyyy-MM-ddTHH:mm:ssXX'; | ||
/** | ||
@@ -19,4 +19,4 @@ * Takes a string or a Date and formats it to what DarkSky's API is expecting. | ||
function formatDateString(date) { | ||
var target = isString(date) ? parse_1.default(date) : date; | ||
if (!is_date_1.default(target) || !is_valid_1.default(target)) { | ||
var target = isString(date) ? parseISO_1.default(date) : date; | ||
if (!isDate_1.default(target) || !isValid_1.default(target)) { | ||
throw errors_1.badRequest("'" + target + "' is not a valid Date object."); | ||
@@ -39,3 +39,3 @@ } | ||
return undefined; | ||
else if (isString(time) || is_date_1.default(time)) | ||
else if (isString(time) || isDate_1.default(time)) | ||
return formatDateString(time); | ||
@@ -42,0 +42,0 @@ else if (isNumber(time)) { |
@@ -5,3 +5,3 @@ import { NumberString, TimeMachineRequest } from '../types'; | ||
*/ | ||
export declare const DARKSKY_DATE_FORMAT = "YYYY-MM-DDTHH:mm:ssZZ"; | ||
export declare const DARKSKY_DATE_FORMAT = "yyyy-MM-ddTHH:mm:ssXX"; | ||
/** | ||
@@ -8,0 +8,0 @@ * Takes a string or a Date and formats it to what DarkSky's API is expecting. |
{ | ||
"name": "darkskyapi-ts", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "A wrapper for DarkSky.net API written in Typescript", | ||
@@ -55,3 +55,3 @@ "keywords": [ | ||
"axios": "^0.19.0", | ||
"date-fns": "^1.30.1" | ||
"date-fns": "^2.0.0" | ||
}, | ||
@@ -72,3 +72,3 @@ "devDependencies": { | ||
"jest-config": "24.9.0", | ||
"lint-staged": "9.2.3", | ||
"lint-staged": "9.2.5", | ||
"lodash.camelcase": "4.3.0", | ||
@@ -79,4 +79,4 @@ "prettier": "1.18.2", | ||
"rimraf": "3.0.0", | ||
"rollup": "1.20.0", | ||
"rollup-plugin-commonjs": "10.0.2", | ||
"rollup": "1.20.3", | ||
"rollup-plugin-commonjs": "10.1.0", | ||
"rollup-plugin-json": "4.0.0", | ||
@@ -87,5 +87,5 @@ "rollup-plugin-node-builtins": "2.1.2", | ||
"rollup-plugin-sourcemaps": "0.4.2", | ||
"rollup-plugin-typescript2": "0.22.1", | ||
"rollup-plugin-typescript2": "0.23.0", | ||
"rollup-plugin-uglify": "6.0.2", | ||
"semantic-release": "15.13.21", | ||
"semantic-release": "15.13.24", | ||
"shelljs": "0.8.3", | ||
@@ -92,0 +92,0 @@ "ts-jest": "24.0.2", |
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 not supported yet
1209725
14104
+ Added@babel/runtime@7.24.5(transitive)
+ Addeddate-fns@2.30.0(transitive)
+ Addedregenerator-runtime@0.14.1(transitive)
- Removeddate-fns@1.30.1(transitive)
Updateddate-fns@^2.0.0