vlang / v

Simple, fast, safe, compiled language for developing maintainable software. Compiles itself in <1s with zero library dependencies. Supports automatic C => V translation. https://vlang.io
MIT License
35.8k stars 2.16k forks source link

time.TimeParseError: Invalid time format code: 0, error: invalid month three letters #20073

Closed AritraBanik08 closed 11 months ago

AritraBanik08 commented 11 months ago

Describe the bug

Code: https://vosca.dev/p/742e925f3f

import time

fn main() {
    c := 'Dec 04 2023'
    s := time.parse_format(c, 'MMM DD YYYY') or { panic(err) }
    a := s.str()
    t := time.parse(a) or { panic('failing format: ${a} | err: ${err}') }
    println(t)
}

Reproduction Steps

Run the above code please. Thank you.

Expected Behavior

2023-12-04 00:00:00

Current Behavior

Output:

V panic: time.TimeParseError: Invalid time format code: 0, error: invalid month three letters
v hash: cd337e2
/tmp/v_60000/../../../../../../home/admin/v/vlib/builtin/builtin.c.v:119: at _v_panic: Backtrace
/tmp/v_60000/../../../../../../box/code.v:5: by main__main
/tmp/v_60000/../../../../../../tmp/v_60000/code.14312254348786731813.tmp.c:17024: by main
Exited with error status 1

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.4.3 cd337e2

Environment details (OS name and version, etc.)

V full version: V 0.4.3 cd337e2
OS: linux, Debian GNU/Linux 11 (bullseye) (VM)
Processor: 1 cpus, 64bit, little endian, Intel(R) Xeon(R) CPU E5-2686 v4 @ 2.30GHz

getwd: /home/admin/playground
vexe: /home/admin/v/v
vexe mtime: 2023-11-11 13:42:45

vroot: OK, value: /home/admin/v
VMODULES: OK, value: /.vmodules
VTMP: OK, value: /tmp/v_0

Git version: git version 2.30.2
Git vroot status: Error: fatal: not a git repository (or any of the parent directories): .git
.git/config present: false

CC version: cc (Debian 10.2.1-6) 10.2.1 20210110
thirdparty/tcc: N/A

[!NOTE] You can use the šŸ‘ reaction to increase the issue's priority for developers.

Please note that only the šŸ‘ reaction to the issue itself counts as a vote. Other reactions and those to comments will not be taken into account.

Delta456 commented 11 months ago

The snippet given by you is working. Please try the latest version of V, the playground seems very outdated.

2023-12-04 00:00:00
AritraBanik08 commented 11 months ago

I am already using the latest version of Vlang. Please test by running the code on https://play.vlang.io/. Thank you.

shove70 commented 11 months ago

The version at https://play.vlang.io/ is not the latest

The version at https://play.vosca.dev/ will be updated, so test it out here:

image
AritraBanik08 commented 11 months ago

The V version 0.4.3 4b31092 is not available on github, where can I get it?

shove70 commented 11 months ago

Can you provide information that is not available?

Please refer to: https://github.com/vlang/v/blob/master/README.md#installing-v-from-source