Skip to content

Commit

Permalink
Fix date_format modifier to keep the same behaviour as before
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidvanErkelens committed Jul 23, 2019
1 parent d8eda52 commit ab87ddb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
5 changes: 4 additions & 1 deletion src/builtin/date_format.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,12 @@ class DateFormatModifier : public Modifier
{
// parse the time
ParsedTime parsed(datetime);

// If parsing was unsuccessful, throw so that the original string is kept
if (!parsed) throw false;

// was this a success? if not we use the current time
return process(parsed ? parsed : time(nullptr), params);
return process(parsed, params);
}


Expand Down
17 changes: 8 additions & 9 deletions src/builtin/parsedtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,19 @@ class ParsedTime
*/
operator const timelib_tzinfo * () const { return _info; }
};

/**
* The actual time that was parsed
* @var timelib_time
*/
timelib_time *_time = nullptr;

/**
* Errors that accured while parsing
* @var timelib_error_container
*/
timelib_error_container *_errors = nullptr;

/**
* The actual time that was parsed
* @var timelib_time
*/
timelib_time *_time = nullptr;

/**
* Get the internal representation
* @return timelib_time *
Expand All @@ -95,9 +95,8 @@ class ParsedTime
* @return timelib_time *
*/
operator const timelib_time * () const { return _time; }


private:


/**
* Constructor to get the current time
* @param timezone Timezone info
Expand Down

0 comments on commit ab87ddb

Please sign in to comment.