Skip to content

Commit

Permalink
fix: toISODate, toISO and toSQLDate methods could return null when an…
Browse files Browse the repository at this point in the history
… InvalidDate is provided (#1406)
  • Loading branch information
edoeel authored Aug 3, 2024
1 parent eb71ce5 commit 612e1ce
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/datetime.js
Original file line number Diff line number Diff line change
Expand Up @@ -1823,7 +1823,7 @@ export default class DateTime {
* @example DateTime.now().toISO() //=> '2017-04-22T20:47:05.335-04:00'
* @example DateTime.now().toISO({ includeOffset: false }) //=> '2017-04-22T20:47:05.335'
* @example DateTime.now().toISO({ format: 'basic' }) //=> '20170422T204705.335-0400'
* @return {string}
* @return {string|null}
*/
toISO({
format = "extended",
Expand All @@ -1850,7 +1850,7 @@ export default class DateTime {
* @param {string} [opts.format='extended'] - choose between the basic and extended format
* @example DateTime.utc(1982, 5, 25).toISODate() //=> '1982-05-25'
* @example DateTime.utc(1982, 5, 25).toISODate({ format: 'basic' }) //=> '19820525'
* @return {string}
* @return {string|null}
*/
toISODate({ format = "extended" } = {}) {
if (!this.isValid) {
Expand Down Expand Up @@ -1935,7 +1935,7 @@ export default class DateTime {
/**
* Returns a string representation of this DateTime appropriate for use in SQL Date
* @example DateTime.utc(2014, 7, 13).toSQLDate() //=> '2014-07-13'
* @return {string}
* @return {string|null}
*/
toSQLDate() {
if (!this.isValid) {
Expand Down

0 comments on commit 612e1ce

Please sign in to comment.