From 6a13d75ebf1cad962ef45c80d31bbc27ed5b6ce2 Mon Sep 17 00:00:00 2001
From: Bubbi12 <Bubbi12@github.com>
Date: Sun, 11 Oct 2020 16:11:30 +0200
Subject: [PATCH] in_range function updated. Now it is possible to specify
 timezone for the ct function

---
 R/in_range.R | 9 +++++++--
 testfile.txt | 1 -
 2 files changed, 7 insertions(+), 3 deletions(-)
 delete mode 100644 testfile.txt

diff --git a/R/in_range.R b/R/in_range.R
index 368be5c..2ca3268 100644
--- a/R/in_range.R
+++ b/R/in_range.R
@@ -19,6 +19,7 @@
 #' @param tstart The start of the period.
 #' @param time The timestamps as POSIX.
 #' @param tend The end of the period. If not given then the period will have no end. 
+#' @param timezone The timezone of the timestamps, time.
 #' @return A logical vector indicating the selected period with TRUE
 #' @name in_range
 #' @examples
@@ -46,12 +47,16 @@
 #'
 #' @export
 
-in_range <- function(tstart, time, tend=NA) {
+in_range <- function(tstart, time, tend=NA, timezone=NA) {
     if (class(tstart)[1] == "character") 
         tstart <- ct(tstart)
     if (is.na(tend))
         tend <- time[length(time)]
     if (class(tend)[1] == "character") 
         tend <- ct(tend)
-    ct(tstart) < time & time <= ct(tend)
+    if (is.na(timezone)){
+        timezone <- attr(D$t, "tzone")
+    }
+
+    ct(tstart, tz = timezone) < time & time <= ct(tend, tz = timezone)
 }
diff --git a/testfile.txt b/testfile.txt
deleted file mode 100644
index 0a90125..0000000
--- a/testfile.txt
+++ /dev/null
@@ -1 +0,0 @@
-Testing
\ No newline at end of file
-- 
GitLab