[Bps-public-commit] rtx-calendar branch multiple-days-events updated. 1.05-32-g3000ff4

BPS Git Server git at git.bestpractical.com
Tue Sep 26 15:53:21 UTC 2023


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rtx-calendar".

The branch, multiple-days-events has been updated
       via  3000ff4ecedf3356efae1e5d09fd4c074da7c0f0 (commit)
      from  99dd72714e9065b0763def0a46b3b7237a409abd (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 3000ff4ecedf3356efae1e5d09fd4c074da7c0f0
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Sep 26 11:47:07 2023 -0400

    Handle Date custom fields correctly
    
    Unlike DateTime, Date values don't have time part and thus no timezone.
    E.g. for 2023-09-26, it should always be 2023-09-26, no matter what
    timezone current user is in.

diff --git a/html/Elements/CalendarEvent b/html/Elements/CalendarEvent
index db29d65..5f018b3 100644
--- a/html/Elements/CalendarEvent
+++ b/html/Elements/CalendarEvent
@@ -92,8 +92,8 @@ if ( ( !grep { $_ eq $TicketId } @$spanning_tickets_for_tomorrow ) ) {
         if (grep { $_ eq $cf_obj->Type} qw(DateTime Date)) {
             my $date_value = RT::Date->new($session{'CurrentUser'});
             my $date_format = $cf_obj->Type eq 'DateTime' ? 'ISO' : 'unknown';
-            $date_value->Set(Format => $date_format, Value => $value, Timezone => 'UTC');
-            $value = $date_value->AsString( Timezone => 'user' );
+            $date_value->Set(Format => $date_format, Value => $value);
+            $value = $date_value->AsString( Timezone => 'user', Time => $cf_obj->Type eq 'DateTime' ? 1 : 0 );
         }
     } else {
         my $method = '$Object->'.$attr.'()';
diff --git a/lib/RTx/Calendar.pm b/lib/RTx/Calendar.pm
index 7160279..141eb7a 100644
--- a/lib/RTx/Calendar.pm
+++ b/lib/RTx/Calendar.pm
@@ -199,7 +199,6 @@ sub GetDate {
             $DateObj->Set(
                 Format   => 'unknown',
                 Value    => $CFDateValue,
-                Timezone => 'utc'
             );
         } else {
             $DateObj->Set( Format => 'ISO', Value => $CFDateValue );

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

Summary of changes:
 html/Elements/CalendarEvent | 4 ++--
 lib/RTx/Calendar.pm         | 1 -
 2 files changed, 2 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
rtx-calendar


More information about the Bps-public-commit mailing list