File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -11,9 +11,17 @@ import (
11
11
)
12
12
13
13
func writeDate (format string , timezone string ) {
14
- log .Print (format )
15
- log .Print (timezone )
16
- _ = clipboard .WriteAll (format + timezone )
14
+
15
+ loc , e := time .LoadLocation (timezone )
16
+ if e != nil {
17
+ log .Fatal (e )
18
+ }
19
+ now := time .Now ().In (loc )
20
+
21
+ timestamp := now .Format (format )
22
+ clip := timestamp
23
+ println (clip + " copied to clipboard" )
24
+ _ = clipboard .WriteAll (clip )
17
25
18
26
}
19
27
@@ -29,7 +37,7 @@ func mainCliApp() error {
29
37
Flags : []cli.Flag {
30
38
& cli.StringFlag {
31
39
Name : "format" ,
32
- Value : "YYYY-MM-DDTHH:MM:SSZ " ,
40
+ Value : "2006-01-02T15:04:05Z07:00 " ,
33
41
Usage : "Timestamp format" ,
34
42
},
35
43
& cli.StringFlag {
@@ -43,6 +51,7 @@ func mainCliApp() error {
43
51
format := c .String ("format" )
44
52
timezone := c .String ("timezone" )
45
53
writeDate (format , timezone )
54
+
46
55
return nil
47
56
},
48
57
}
You can’t perform that action at this time.
0 commit comments