aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2025-01-01 21:02:33 +0100
committerHarald Eilertsen <haraldei@anduin.net>2025-01-01 21:02:33 +0100
commit4fd3607bb9c0c1fa9c476860d44424c89150b2f6 (patch)
treed98c9c005f44dd6cd7eb42be3936e4bd94366038 /src
parentb47f2bf0004a063fb8112fbfd0b27193c79b28e3 (diff)
downloadicaltool-4fd3607bb9c0c1fa9c476860d44424c89150b2f6.tar.gz
icaltool-4fd3607bb9c0c1fa9c476860d44424c89150b2f6.tar.bz2
icaltool-4fd3607bb9c0c1fa9c476860d44424c89150b2f6.zip
Update dependencies.
Diffstat (limited to 'src')
-rw-r--r--src/icaltool.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/icaltool.rs b/src/icaltool.rs
index d11c3d1..9910463 100644
--- a/src/icaltool.rs
+++ b/src/icaltool.rs
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
-use chrono::{DateTime, TimeZone, Utc};
+use chrono::{DateTime, FixedOffset, Utc};
use ical::{
IcalParser,
parser::ical::component::{
@@ -66,7 +66,7 @@ impl Icaltool {
}
}
-fn parse_datetime(datetime: Option<String>) -> Option<DateTime<Utc>> {
+fn parse_datetime(datetime: Option<String>) -> Option<DateTime<FixedOffset>> {
if let Some(mut dt) = datetime {
if dt.is_empty() {
return None;
@@ -75,7 +75,7 @@ fn parse_datetime(datetime: Option<String>) -> Option<DateTime<Utc>> {
if !dt.contains('T') {
dt += "T000000";
}
- Utc.datetime_from_str(&dt, "%Y%m%dT%H%M%S").ok()
+ DateTime::parse_from_str(&dt, "%Y%m%dT%H%M%S").ok()
}
else {
None
@@ -83,8 +83,8 @@ fn parse_datetime(datetime: Option<String>) -> Option<DateTime<Utc>> {
}
fn print_event(event: &IcalEvent) {
- let mut start: Option<DateTime<Utc>> = None;
- let mut end: Option<DateTime<Utc>> = None;
+ let mut start: Option<DateTime<FixedOffset>> = None;
+ let mut end: Option<DateTime<FixedOffset>> = None;
let mut summary = String::new();
let mut description = String::new();
@@ -99,8 +99,8 @@ fn print_event(event: &IcalEvent) {
}
println!("---> {} - {}: {}",
- start.unwrap_or_else(Utc::now),
- end.unwrap_or_else(Utc::now),
+ start.unwrap_or_else(|| Utc::now().fixed_offset()),
+ end.unwrap_or_else(|| Utc::now().fixed_offset()),
summary);
if description.len() > 0 {