Skip to content

Commit 612e1ce

Browse files
authored
fix: toISODate, toISO and toSQLDate methods could return null when an InvalidDate is provided (#1406)
1 parent eb71ce5 commit 612e1ce

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/datetime.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1823,7 +1823,7 @@ export default class DateTime {
18231823
* @example DateTime.now().toISO() //=> '2017-04-22T20:47:05.335-04:00'
18241824
* @example DateTime.now().toISO({ includeOffset: false }) //=> '2017-04-22T20:47:05.335'
18251825
* @example DateTime.now().toISO({ format: 'basic' }) //=> '20170422T204705.335-0400'
1826-
* @return {string}
1826+
* @return {string|null}
18271827
*/
18281828
toISO({
18291829
format = "extended",
@@ -1850,7 +1850,7 @@ export default class DateTime {
18501850
* @param {string} [opts.format='extended'] - choose between the basic and extended format
18511851
* @example DateTime.utc(1982, 5, 25).toISODate() //=> '1982-05-25'
18521852
* @example DateTime.utc(1982, 5, 25).toISODate({ format: 'basic' }) //=> '19820525'
1853-
* @return {string}
1853+
* @return {string|null}
18541854
*/
18551855
toISODate({ format = "extended" } = {}) {
18561856
if (!this.isValid) {
@@ -1935,7 +1935,7 @@ export default class DateTime {
19351935
/**
19361936
* Returns a string representation of this DateTime appropriate for use in SQL Date
19371937
* @example DateTime.utc(2014, 7, 13).toSQLDate() //=> '2014-07-13'
1938-
* @return {string}
1938+
* @return {string|null}
19391939
*/
19401940
toSQLDate() {
19411941
if (!this.isValid) {

0 commit comments

Comments
 (0)