luxon-parser
Advanced tools
Comparing version 0.9.3 to 0.9.4
@@ -52,3 +52,3 @@ const parser = require('any-date-parser'); | ||
} else if (typeof date === 'object') { | ||
return DateTime.fromObject(date); | ||
return DateTime.fromObject(date, options); | ||
} | ||
@@ -55,0 +55,0 @@ // String |
{ | ||
"name": "luxon-parser", | ||
"version": "0.9.3", | ||
"version": "0.9.4", | ||
"description": "Add DateTime.fromHuman() and DateTime.fromAny() functions to Luxon that can parse a wide range of date formats including human-input dates", | ||
@@ -38,9 +38,9 @@ "keywords": [ | ||
"peerDependencies": { | ||
"luxon": "^1.26.0" | ||
"luxon": ">=1.28.0" | ||
}, | ||
"devDependencies": { | ||
"eslint": "8.7.0", | ||
"jest": "27.4.7", | ||
"prettier": "2.5.1" | ||
"eslint": "8.32.0", | ||
"jest": "29.3.1", | ||
"prettier": "2.8.3" | ||
} | ||
} |
# luxon-parser | ||
[](https://npmjs.com/package/luxon-parser) | ||
[](https://ci.appveyor.com/project/kensnyder/luxon-parser/branch/master) | ||
[](https://codecov.io/gh/kensnyder/luxon-parser) | ||
[](https://opensource.org/licenses/ISC) | ||
[](https://npmjs.com/package/luxon-parser) | ||
[](https://ci.appveyor.com/project/kensnyder/luxon-parser/branch/master) | ||
[](https://codecov.io/gh/kensnyder/luxon-parser) | ||
[](https://opensource.org/licenses/ISC) | ||
@@ -98,3 +98,3 @@ A comprehensive and extensible date parsing plugin for | ||
`luxon-parser` relies on | ||
[any-date-format](https://www.npmjs.com/package/any-date-parser) which supports | ||
[any-date-parser](https://www.npmjs.com/package/any-date-parser) which supports | ||
even more formats. See the | ||
@@ -106,3 +106,3 @@ [exhaustive list](https://www.npmjs.com/package/any-date-parser#exhaustive-list-of-date-formats). | ||
See | ||
[any-date-format's instructions](https://www.npmjs.com/package/any-date-parser#adding-custom-formats). | ||
[any-date-parser's instructions](https://www.npmjs.com/package/any-date-parser#adding-custom-formats). | ||
@@ -140,5 +140,5 @@ Example: | ||
- Standalone Parser: | ||
[any-date-format](http://npmjs.com/packages/any-date-format) | ||
- DayJS: [dayjs-parser](http://npmjs.com/package/dayjs-parse) | ||
- Moment: [moment-parseplus](http://npmjs.com/package/moment-parseplus) | ||
[any-date-parser](http://npmjs.com/packages/any-date-parser) | ||
- DayJS Parser: [dayjs-parser](http://npmjs.com/package/dayjs-parser) | ||
- Moment Parser: [moment-parseplus](http://npmjs.com/package/moment-parseplus) | ||
@@ -145,0 +145,0 @@ ## Unit Testing |
@@ -86,2 +86,24 @@ const { DateTime } = require('luxon'); | ||
}); | ||
it('should handle object with options', () => { | ||
const object = { | ||
year: 2021, | ||
month: 4, | ||
day: 17, | ||
hour: 0, | ||
minute: 0, | ||
second: 0, | ||
}; | ||
const optionsFiji = { | ||
zone: 'Pacific/Fiji', | ||
}; | ||
const optionsFaroe = { | ||
zone: 'Atlantic/Faroe', | ||
}; | ||
const actualFiji = DateTime.fromAny(object, optionsFiji); | ||
const expectedFiji = DateTime.fromObject(object, optionsFiji); | ||
expect(actualFiji.toString()).toBe(expectedFiji.toString()); | ||
const actualFaroe = DateTime.fromAny(object, optionsFaroe); | ||
const expectedFaroe = DateTime.fromObject(object, optionsFaroe); | ||
expect(actualFaroe.toString()).toBe(expectedFaroe.toString()); | ||
}); | ||
it('should default to invalid', () => { | ||
@@ -88,0 +110,0 @@ const actual = DateTime.fromAny('my toys are sticky'); |
Sorry, the diff of this file is not supported yet
26350
430