File Coverage

blib/lib/Jifty/DBI/Filter/Date.pm
Criterion Covered Total %
statement 18 18 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod n/a
total 24 24 100.0


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