mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
TW-1522
- TW-1522 Date format doesn't like hyphens (thanks to Scott Carter).
This commit is contained in:
parent
4865269630
commit
6626207ad1
11 changed files with 30 additions and 10 deletions
2
AUTHORS
2
AUTHORS
|
@ -242,3 +242,5 @@ suggestions:
|
|||
Ozgur Akgun
|
||||
David Costa
|
||||
Sujeevan Vijayakumaran
|
||||
Scott Carter
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
to Tomas Babej).
|
||||
- TW-1519 Testing suite forces taskd.trust="ignore hostname" (thanks to Renato
|
||||
Alves).
|
||||
- TW-1522 Date format doesn't like hyphens (thanks to Scott Carter).
|
||||
- Fixed assorted color theme problems.
|
||||
- Changed assorted reports so they do not use '.age' format for dates that are
|
||||
in the future, because those are never shown with this format (thanks to
|
||||
|
|
4
NEWS
4
NEWS
|
@ -9,7 +9,9 @@ New commands in taskwarrior 2.4.1
|
|||
|
||||
New configuration options in taskwarrior 2.4.1
|
||||
|
||||
-
|
||||
- The 'date.iso' setting allows you to enable (default) or disable support
|
||||
for ISO-8601 dates. This is because some of you have 'dateformat' settings
|
||||
that conflict.
|
||||
|
||||
Newly deprecated features in taskwarrior 2.4.1
|
||||
|
||||
|
|
|
@ -615,6 +615,10 @@ field that is set. Otherwise, they are set to the corresponding values of
|
|||
.RE
|
||||
.RE
|
||||
|
||||
.TP
|
||||
.B date.iso=yes
|
||||
Enables ISO-8601 date support. The default value is "yes".
|
||||
|
||||
.TP
|
||||
.B weekstart=Sunday
|
||||
Determines the day a week starts. Valid values are Sunday or Monday only. The
|
||||
|
|
|
@ -116,6 +116,7 @@ std::string Config::_defaults =
|
|||
"dateformat.info=Y-M-D H:N:S # Preferred display date format for information\n"
|
||||
"dateformat.report= # Preferred display date format for reports\n"
|
||||
"dateformat.annotation= # Preferred display date format for annotations\n"
|
||||
"date.iso=yes # Enable ISO date support\n"
|
||||
"weekstart="
|
||||
STRING_DATE_SUNDAY_LONG
|
||||
" # Sunday or Monday only\n"
|
||||
|
|
|
@ -658,6 +658,7 @@ void Context::staticInitialization ()
|
|||
Task::searchCaseSensitive = Variant::searchCaseSensitive = config.getBoolean ("search.case.sensitive");
|
||||
Task::regex = Variant::searchUsingRegex = config.getBoolean ("regex");
|
||||
Lexer::dateFormat = Variant::dateFormat = config.get ("dateformat");
|
||||
Lexer::isoEnabled = Variant::isoEnabled = config.getBoolean ("date.iso");
|
||||
|
||||
std::map <std::string, Column*>::iterator i;
|
||||
for (i = columns.begin (); i != columns.end (); ++i)
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include <i18n.h>
|
||||
|
||||
std::string Lexer::dateFormat = "";
|
||||
bool Lexer::isoEnabled = true;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Lexer::Lexer (const std::string& input)
|
||||
|
@ -732,6 +733,8 @@ void Lexer::dequote (std::string& input)
|
|||
bool Lexer::is_date (std::string& result)
|
||||
{
|
||||
// Try an ISO date parse.
|
||||
if (isoEnabled)
|
||||
{
|
||||
std::string::size_type iso_i = 0;
|
||||
std::string iso_result;
|
||||
ISO8601d iso;
|
||||
|
@ -742,6 +745,7 @@ bool Lexer::is_date (std::string& result)
|
|||
while (iso_i--) shift ();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Try a legacy rc.dateformat parse here.
|
||||
if (Lexer::dateFormat != "")
|
||||
|
|
|
@ -34,6 +34,7 @@ class Lexer
|
|||
{
|
||||
public:
|
||||
static std::string dateFormat;
|
||||
static bool isoEnabled;
|
||||
|
||||
enum Type
|
||||
{
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
std::string Variant::dateFormat = "";
|
||||
bool Variant::searchCaseSensitive = true;
|
||||
bool Variant::searchUsingRegex = true;
|
||||
bool Variant::isoEnabled = true;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Variant::Variant ()
|
||||
|
@ -2065,7 +2066,8 @@ void Variant::cast (const enum type new_type)
|
|||
|
||||
ISO8601d iso;
|
||||
std::string::size_type pos = 0;
|
||||
if (iso.parse (_string, pos) &&
|
||||
if (isoEnabled &&
|
||||
iso.parse (_string, pos) &&
|
||||
pos == _string.length ())
|
||||
{
|
||||
_date = (time_t) iso;
|
||||
|
|
|
@ -37,6 +37,7 @@ public:
|
|||
static std::string dateFormat;
|
||||
static bool searchCaseSensitive;
|
||||
static bool searchUsingRegex;
|
||||
static bool isoEnabled;
|
||||
|
||||
enum type {type_unknown, type_boolean, type_integer, type_real, type_string,
|
||||
type_date, type_duration};
|
||||
|
|
|
@ -134,6 +134,7 @@ int CmdShow::execute (std::string& output)
|
|||
" dateformat.holiday"
|
||||
" dateformat.info"
|
||||
" dateformat.report"
|
||||
" date.iso"
|
||||
" debug"
|
||||
" debug.hooks"
|
||||
" debug.parser"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue