parse time in local
This commit is contained in:
parent
4cfd4fbd28
commit
48fede581a
14
heatmap.go
14
heatmap.go
@ -33,7 +33,7 @@ func main() {
|
||||
endDate := time.Date(time.Now().Year(), time.Now().Month(), time.Now().Day(), 0, 0, 0, 0, time.Local)
|
||||
if endDateArg != "" {
|
||||
var err error
|
||||
endDate, err = time.Parse("2006-01-02", endDateArg)
|
||||
endDate, err = time.ParseInLocation("2006-01-02", endDateArg, time.Local)
|
||||
if err != nil {
|
||||
fmt.Println("failed to parse end time")
|
||||
return
|
||||
@ -42,7 +42,7 @@ func main() {
|
||||
start := time.Date(endDate.Year()-1, endDate.Month(), endDate.Day(), 0, 0, 0, 0, time.Local)
|
||||
if startDateArg != "" {
|
||||
var err error
|
||||
start, err = time.Parse("2006-01-02", startDateArg)
|
||||
start, err = time.ParseInLocation("2006-01-02", startDateArg, time.Local)
|
||||
if err != nil {
|
||||
fmt.Println("failed to parse start time")
|
||||
return
|
||||
@ -106,9 +106,13 @@ func main() {
|
||||
}
|
||||
svg = fmt.Sprintf("%s\n</g></g>", svg)
|
||||
|
||||
//week labels
|
||||
//tODO: parameterize
|
||||
svg = fmt.Sprintf("%s<g transform=\"translate(6, 16)\"><text x=\"0\" y=\"30\">Mon</text><text x=\"0\" y=\"64\">Wed</text><text x=\"0\" y=\"97\">Fri</text></g>", svg)
|
||||
//day of week labels
|
||||
//note to self, text position is the bottom left of the _baseline_ of text
|
||||
svg = fmt.Sprintf("%s<g transform=\"translate(6, 24)\">", svg)
|
||||
svg = fmt.Sprintf("%s<text x=\"0\" y=\"%v\">Mon</text>", svg, length*2-(length/3))
|
||||
svg = fmt.Sprintf("%s<text x=\"0\" y=\"%v\">Wed</text>", svg, length*4-(length/3))
|
||||
svg = fmt.Sprintf("%s<text x=\"0\" y=\"%v\">Fri</text>", svg, length*6-(length/3))
|
||||
svg = fmt.Sprintf("%s</g>", svg)
|
||||
|
||||
//month labels
|
||||
svg = fmt.Sprintf("%s<g transform=\"translate(30,14)\">", svg)
|
||||
|
Loading…
Reference in New Issue
Block a user