We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 432ee0a commit 10220a8Copy full SHA for 10220a8
crates/vm/src/stdlib/time.rs
@@ -631,6 +631,22 @@ mod decl {
631
if !(1..=9999).contains(&year) {
632
return Err(vm.new_value_error("strftime() requires year in [1; 9999]".to_owned()));
633
}
634
+ // %y requires year >= 1900 on Windows
635
+ if tm.tm_year < 0 {
636
+ let fmt = format.as_str();
637
+ let mut chars = fmt.chars();
638
+ while let Some(ch) = chars.next() {
639
+ if ch == '%' {
640
+ if let Some(next) = chars.next() {
641
+ if next == 'y' {
642
+ return Err(vm.new_value_error(
643
+ "format %y requires year >= 1900 on Windows".to_owned(),
644
+ ));
645
+ }
646
647
648
649
650
651
652
#[cfg(unix)]
0 commit comments