spf13 / spf13/cast

[BUG] Unixtimestemp in string

Open
#102 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
4k
Forks
337
Avg merge
15m
Merged PRs (30d)
1

Description

panic: 2> unable to parse date: 1600285405

Code for reproduction:

https://play.golang.org/p/yyxxFcFhQg1

package main

import (
	"fmt"
	cast "github.com/spf13/cast"
)

func main() {
	val, err := cast.ToTimeE(1600285405)
	if err != nil {
		panic(fmt.Sprintf("1> %v", err))
	}
	fmt.Println(val)

	val, err = cast.ToTimeE(fmt.Sprintf("%v", 1600285405))
	fmt.Println(val)

	if err != nil {
		panic(fmt.Sprintf("2> %v", err))
	}
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked Go playground reproduction and trace the ToTimeE entry point for numeric and string inputs. Compare how each input is parsed, then verify that a Unix timestamp supplied as a string behaves consistently with the numeric value.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.