Skip to content
Browse files

r47499@loki: spang | 2008-08-01 15:52:01 +0100

  r47494@loki (orig r14704):  jesse | 2008-08-01 04:40:24 +0100
  * Removed deps on DateTime and Clone
  r47496@loki (orig r14706):  sartak | 2008-08-01 14:47:45 +0100
   r68240@onn:  sartak | 2008-08-01 09:47:29 -0400
   Revert to checking the content arg instead of the content prop, since this is prop-agnostic
  
 


git-svn-id: svn://s.ly/sd/trunk@15076 e417ac7c-1bcc-0310-8ffa-8f5827389a85
  • Loading branch information...
1 parent 2226887 commit 1b01b966168cf34212c84a14cca2c8d26c21309b @spang spang committed Aug 12, 2008
Showing with 17 additions and 20 deletions.
  1. +1 −2 Makefile.PL
  2. +1 −1 lib/App/SD/CLI/Command.pm
  3. +6 −14 lib/App/SD/Model/Ticket.pm
  4. +9 −3 lib/App/SD/Record.pm
View
3 Makefile.PL
@@ -6,14 +6,13 @@ license('MIT');
version_from('lib/App/SD.pm');
requires 'Prophet'; # URI UNIVERSAL::require Params::Validate Path::Class Class::Accessor
-requires('Clone');
requires('Moose'); # Moose::Role
-requires('DateTime');
features(
'RT sync' => [
-default => 0,
'RT::Client::REST' => 0, # RT::Client::REST::Ticket
+ 'HTTP::Date' => 0,
],
View
2 lib/App/SD/CLI/Command.pm
@@ -32,7 +32,7 @@ sub get_content {
if (my $file = file($self->delete_arg('file'))) {
$content = $file->slurp();
$self->set_prop(name => $file->basename);
- } elsif ($content = $self->delete_prop('content')) {
+ } elsif ($content = $self->delete_arg('content')) {
} elsif ($args{default_edit} || $self->has_arg('edit')) {
my $text = '';
View
20 lib/App/SD/Model/Ticket.pm
@@ -3,6 +3,7 @@ use Moose;
extends 'App::SD::Record';
use Term::ANSIColor;
+use HTTP::Date;
use constant collection_class => 'App::SD::Collection::Ticket';
use constant type => 'ticket';
@@ -96,20 +97,11 @@ sub is_overdue {
return 0;
}
- my $dt = eval { DateTime->new(
- year => $1,
- month => $2,
- day => $3,
- hour => $4,
- minute => $5,
- second => $6,
- time_zone => 'UTC',
- ) };
- warn $@ if $@;
- return 0 if !$dt;
-
- my $now = DateTime->now(time_zone => 'UTC');
- return $now > $dt;
+ my $then = HTTP::Date::str2time($date, 'GMT');
+ return 0 if !$then;
+
+ my $now = time();
+ return $now > $then;
}
__PACKAGE__->register_reference( comments => 'App::SD::Collection::Comment', by => 'ticket');
View
12 lib/App/SD/Record.pm
@@ -4,7 +4,6 @@ use strict;
package App::SD::Record; # should probably be Prophet::App::Record
use Moose;
use Params::Validate;
-use DateTime;
sub declared_props { 'created', inner() }
@@ -25,8 +24,15 @@ sub canonicalize_prop_created {
|| $props->{date};
if (!$created ) {
- my $date = DateTime->now;
- $args{props}->{created} = $date->ymd." ".$date->hms;
+ my @now = gmtime();
+
+ $args{props}->{created} = sprintf(
+ "%04d-%02d-%02d %02d:%02d:%02d",
+ ( $now[5] + 1900 ),
+ ( $now[4] + 1 ),
+ $now[3], $now[2], $now[1], $now[0]
+ );
+
}
return 1;
}

0 comments on commit 1b01b96

Please sign in to comment.
Something went wrong with that request. Please try again.