File Coverage

blib/lib/Jifty/DBI/Filter/Time.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 20 20 100.0


line stmt bran cond sub pod time code
1             package Jifty::DBI::Filter::Time;
2              
3 3     3   17 use warnings;
  3         5  
  3         114  
4 3     3   12 use strict;
  3         4  
  3         93  
5              
6 3     3   15 use base qw|Jifty::DBI::Filter::DateTime|;
  3         6  
  3         288  
7              
8 3     3   15 use constant _time_zone => 'floating';
  3         4  
  3         174  
9 3     3   17 use constant _strptime => '%H:%M:%S';
  3         5  
  3         188  
10              
11             =head1 NAME
12              
13             Jifty::DBI::Filter::Date - DateTime object wrapper around date columns
14              
15             =head1 DESCRIPTION
16              
17             This filter allow you to work with DateTime objects that represent "Dates",
18             store everything in the database in GMT and not hurt yourself badly
19             when you pull them out and put them in repeatedly.
20              
21             =head2 encode
22              
23             If value is a DateTime object then move it into a "floating" timezone
24             and expand it into ISO 8601 format C. By storing it in
25             the database as a floating timezone, it doesn't matter if the user's
26             desired timezone changes between lookups
27              
28             Does nothing if value is not defined or is a string.
29              
30             =cut
31              
32             =head2 decode
33              
34             If we're loading something from a column that doesn't specify times, then
35             it's loaded into a floating timezone.
36              
37             If value is defined then converts it into DateTime object otherwise do
38             nothing.
39              
40             =cut
41              
42              
43             =head1 SEE ALSO
44              
45             L, L
46              
47             =cut
48              
49             1;