[Bps-public-commit] SD - A distributed issue tracker branch, master, updated. cd419fb279aae5741c7c36fc91c5d15d3f540344

jesse jesse at bestpractical.com
Mon Jan 19 11:29:50 EST 2009


The branch, master has been updated
       via  cd419fb279aae5741c7c36fc91c5d15d3f540344 (commit)
      from  616356601606f35544a391786750d1364042ef9d (commit)

Summary of changes:
 Makefile.PL                |    2 +-
 lib/App/SD/Model/Ticket.pm |    7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

- Log -----------------------------------------------------------------
commit cd419fb279aae5741c7c36fc91c5d15d3f540344
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Mon Jan 19 11:24:27 2009 -0500

    Autocomplete possible due dates in the web ui

diff --git a/Makefile.PL b/Makefile.PL
index c1c4409..533ee8c 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -9,7 +9,7 @@ requires('Path::Class');
 requires 'Prophet'; # URI UNIVERSAL::require Params::Validate Class::Accessor Template::Declare::Tags Test::HTTP::Server::Simple JSON Test::WWW::Mechanize
 requires('Moose'); # Moose::Role
 requires('HTTP::Date');
-
+requires('DateTime::Format::Natural');
 features(
     'RT sync' => [
         -default => 0,
diff --git a/lib/App/SD/Model/Ticket.pm b/lib/App/SD/Model/Ticket.pm
index 57646f4..ef58e11 100644
--- a/lib/App/SD/Model/Ticket.pm
+++ b/lib/App/SD/Model/Ticket.pm
@@ -83,16 +83,17 @@ sub canonicalize_prop_status {
 sub canonicalize_prop_due {
     my $self = shift;
     my %args = @_;
-
-    return 1; # XXX TODO
     my $props = $args{props};
+    # skip blank
     return 1 unless $props->{due};
+    #skip well formed
+    return 1 if $props->{due} =~ /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/; 
     require DateTime::Format::Natural;
     my $parser = DateTime::Format::Natural->new;
     my $dt = $parser->parse_datetime($props->{due});
     if ($parser->success) {
      # operate on $dt/@dt, for example:
-     $props->{due} = sprintf( "%04d-%02d-%02d %02d:%02d:%02d\n", $dt->year, $dt->month, $dt->day, $dt->hour, $dt->min, $dt->sec);
+        $props->{due} = sprintf( "%04d-%02d-%02d %02d:%02d:%02d\n", $dt->year, $dt->month, $dt->day, $dt->hour, $dt->min, $dt->sec);
     }
     return 1;
 }

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list