Skip to content

Commit c1ddd5a

Browse files
committed
Switch export date/time format to '%Y-%m-%d %H:%M:%S' with separate tz column
1 parent 7f4d9b5 commit c1ddd5a

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/handler.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,7 +1126,7 @@ pub async fn report_generate(
11261126
let mut csv = String::new();
11271127

11281128
//CSV column name header
1129-
let mut headers = "index,type,time,value_msat,value_sat,value_msat_total,value_sat_total,action,sender,app,message,podcast,episode,remote_podcast,remote_episode,custom_key,custom_value".to_string();
1129+
let mut headers = "index,type,time,timezone,value_msat,value_sat,value_msat_total,value_sat_total,action,sender,app,message,podcast,episode,remote_podcast,remote_episode,custom_key,custom_value".to_string();
11301130

11311131
if btc_prices.is_some() {
11321132
headers.push_str(",btc_close,value_usd,value_usd_total");
@@ -1162,7 +1162,8 @@ pub async fn report_generate(
11621162
for boost in boosts {
11631163
//Parse out a friendly date
11641164
let dt = DateTime::from_timestamp(boost.time, 0).unwrap_or_else(|| panic!("Unable to parse boost time: {}", boost.time));
1165-
let boost_time = dt.to_rfc3339().to_string();
1165+
let boost_time = dt.format("%Y-%m-%d %H:%M:%S").to_string();
1166+
let boost_timezone = dt.format("%Z").to_string();
11661167

11671168
//Translate to sats
11681169
let mut value_sat = 0;
@@ -1178,10 +1179,11 @@ pub async fn report_generate(
11781179
//The main export data formatting
11791180
csv.push_str(
11801181
format!(
1181-
"{},{},\"{}\",{},{},{},{},{},\"{}\",\"{}\",\"{}\",\"{}\",\"{}\",\"{}\",\"{}\",\"{}\",\"{}\"",
1182+
"{},{},\"{}\",\"{}\",{},{},{},{},{},\"{}\",\"{}\",\"{}\",\"{}\",\"{}\",\"{}\",\"{}\",\"{}\",\"{}\"",
11821183
boost.index,
11831184
list,
11841185
boost_time,
1186+
boost_timezone,
11851187
boost.value_msat,
11861188
value_sat,
11871189
boost.value_msat_total,
@@ -1304,14 +1306,15 @@ pub async fn csv_export_boosts(
13041306
let mut csv = String::new();
13051307

13061308
//CSV column name header
1307-
csv.push_str("count,index,time,value_msat,value_sat,value_msat_total,value_sat_total,action,sender,app,message,podcast,episode,remote_podcast,remote_episode,custom_key,custom_value\n");
1309+
csv.push_str("count,index,time,timezone,value_msat,value_sat,value_msat_total,value_sat_total,action,sender,app,message,podcast,episode,remote_podcast,remote_episode,custom_key,custom_value\n");
13081310

13091311
//Iterate the boost set
13101312
let mut count: u64 = 1;
13111313
for boost in boosts {
13121314
//Parse out a friendly date
13131315
let dt = DateTime::from_timestamp(boost.time, 0).unwrap_or_else(|| panic!("Unable to parse boost time: {}", boost.time));
1314-
let boost_time = dt.to_rfc3339().to_string();
1316+
let boost_time = dt.format("%Y-%m-%d %H:%M:%S").to_string();
1317+
let boost_timezone = dt.format("%Z").to_string();
13151318

13161319
//Translate to sats
13171320
let mut value_sat = 0;
@@ -1326,10 +1329,11 @@ pub async fn csv_export_boosts(
13261329
//The main export data formatting
13271330
csv.push_str(
13281331
format!(
1329-
"{},{},\"{}\",{},{},{},{},{},\"{}\",\"{}\",\"{}\",\"{}\",\"{}\",\"{}\",\"{}\",\"{}\",\"{}\"\n",
1332+
"{},{},\"{}\",\"{}\",{},{},{},{},{},\"{}\",\"{}\",\"{}\",\"{}\",\"{}\",\"{}\",\"{}\",\"{}\",\"{}\"\n",
13301333
count,
13311334
boost.index,
13321335
boost_time,
1336+
boost_timezone,
13331337
boost.value_msat,
13341338
value_sat,
13351339
boost.value_msat_total,

0 commit comments

Comments
 (0)