yyyy-mm-dd
This commit is contained in:
704
src-tauri/Cargo.lock
generated
704
src-tauri/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -1,8 +1,8 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "tauclock"
|
name = "tauclock"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
description = "A Tauri App"
|
description = "A Keyboard Native Clock App"
|
||||||
authors = ["you"]
|
authors = ["Yuya KAMATAKI"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use chrono::{
|
use chrono::{
|
||||||
DateTime, Datelike, Days, Local, LocalResult, NaiveDate, NaiveDateTime, NaiveTime, TimeZone,
|
DateTime, Datelike, Days, Local, LocalResult, NaiveDate, NaiveDateTime, NaiveTime, TimeZone,
|
||||||
Timelike, Utc, Weekday,
|
Timelike, Utc,
|
||||||
};
|
};
|
||||||
use log::{debug, error, info, trace, warn};
|
use log::{debug, error, info, trace, warn};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
@@ -182,9 +182,9 @@ impl StateInner {
|
|||||||
let now_utc = now_local.with_timezone(&Utc);
|
let now_utc = now_local.with_timezone(&Utc);
|
||||||
let clock = ClockState {
|
let clock = ClockState {
|
||||||
local_time: format_time(now_local.hour(), now_local.minute(), now_local.second()),
|
local_time: format_time(now_local.hour(), now_local.minute(), now_local.second()),
|
||||||
local_date: format_date(now_local.weekday(), now_local.month(), now_local.day()),
|
local_date: format_date(now_local.year(), now_local.month(), now_local.day()),
|
||||||
utc_time: format_time(now_utc.hour(), now_utc.minute(), now_utc.second()),
|
utc_time: format_time(now_utc.hour(), now_utc.minute(), now_utc.second()),
|
||||||
utc_date: format_date(now_utc.weekday(), now_utc.month(), now_utc.day()),
|
utc_date: format_date(now_utc.year(), now_utc.month(), now_utc.day()),
|
||||||
};
|
};
|
||||||
let alarms = self.build_alarm_view(now_ms);
|
let alarms = self.build_alarm_view(now_ms);
|
||||||
let timer = self.build_timer_view();
|
let timer = self.build_timer_view();
|
||||||
@@ -682,17 +682,8 @@ fn format_time(hour: u32, minute: u32, second: u32) -> String {
|
|||||||
format!("{:02}:{:02}:{:02}", hour, minute, second)
|
format!("{:02}:{:02}:{:02}", hour, minute, second)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn format_date(weekday: Weekday, month: u32, day: u32) -> String {
|
fn format_date(year: i32, month: u32, day: u32) -> String {
|
||||||
let weekday_label = match weekday {
|
format!("{year:04}-{month:02}-{day:02}")
|
||||||
Weekday::Mon => "月",
|
|
||||||
Weekday::Tue => "火",
|
|
||||||
Weekday::Wed => "水",
|
|
||||||
Weekday::Thu => "木",
|
|
||||||
Weekday::Fri => "金",
|
|
||||||
Weekday::Sat => "土",
|
|
||||||
Weekday::Sun => "日",
|
|
||||||
};
|
|
||||||
format!("{} {}月{:02}日", weekday_label, month, day)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn format_time_label(hour: u8, minute: u8) -> String {
|
fn format_time_label(hour: u8, minute: u8) -> String {
|
||||||
|
|||||||
Reference in New Issue
Block a user