Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

useDateFormat: can't return 0 when the day is sunday and formatStr is 'd' #3268

Closed
7 tasks done
JocelynFloresz opened this issue Jul 30, 2023 · 0 comments · Fixed by #3272
Closed
7 tasks done

useDateFormat: can't return 0 when the day is sunday and formatStr is 'd' #3268

JocelynFloresz opened this issue Jul 30, 2023 · 0 comments · Fixed by #3272

Comments

@JocelynFloresz
Copy link
Contributor

Describe the bug

This PR #3001 leads to useDateFormat() can't return zero value.

return formatStr.replace(REGEX_FORMAT, (match, $1) => $1 || matches[match]?.() || match)

when the day is sunday , useDateFormat(useNow(), 'd') return 'd' instead of 0.

Reproduction

https://play.vueuse.org/#N4IgDghgxg1hDmBTAziAXAbVAOwgW0XRADcBXRAWgBNE8BLEAGhGQHtSAnKQtEU7MDHhMQNZFA50wAFzqtsRAGrkABABFadFQAoAFhAA2AMxV1sKgGIdE2KLoCUp5CogqaxRAdZgz8FaVkDOmkATxcDLwB3ZxD2FWlWFUjJaUQVAFVsOg8OZEMVZTSAGToAIw4ISRQVI1YOAtUAJhUAMhUAZhFOAyJdaWkwZDQAemH+QXgAOihWPGGyShp6YaDS4bMaAA9JvAArVABfRhx8HhAAAQXSZERh5H1rKhE2Tm4icaERMQkpWXkiADKD0QVAaiHSN38gWCdBQky6HB6vD6AyGow+Uxmc0u5Gut3ulRB5wAjAAGSbEyak9bYLY7fYgI4nAhEHGIPHDGbWZ7sLhnDFfFA-GRyBS8ADCrAiiCgf3MrBMKBu2Fk+UKKkleDArGQMPkGWhshQCKRIBRgxGYwEQmms2GbI5XMQJPJlOpG0Q2z2hwAuswjHQDMa0KAAIJgMCTBboUCpLUGCCpIgAHio2QAfAAdcwqVMZ4DANwQMIHA7J4Zp4hZ7DlyvV57C6REbN0LV1aQqQt4tSJxAWOp4ROMfw3AByrEiKgONQ4sxUAHIHTdOXVEPOANzZmbYZAdqjFlQAXhHiB7qX7HEH0m0mZAAP4KgAUqQDB1SSpGqTGu0P8S0MSAFY0AAFmaABxABZAAVABqUkAA5SXfbRAFo5QBftUAcAtADHFQA300AF9T7FvYd5yoed7E3BRSwOIA

System Info

System:
    OS: Windows 10 10.0.22621
    CPU: (12) x64 Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
    Memory: 14.87 GB / 31.94 GB
  Binaries:
    Node: 18.16.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - C:\Program Files\nodejs\yarn.CMD
    npm: 9.5.1 - C:\Program Files\nodejs\npm.CMD
    pnpm: 8.6.0 - C:\Program Files\nodejs\pnpm.CMD
  Browsers:
    Edge: Spartan (44.22621.2070.0), Chromium (115.0.1901.188)
    Internet Explorer: 11.0.22621.1

Used Package Manager

pnpm

Validations

@JocelynFloresz JocelynFloresz changed the title fix(useDateFormat): can't return 0 when sunday and 'd' formatStr fix(useDateFormat): can't return 0 when the day is sunday and formatStr is 'd' Jul 30, 2023
@JocelynFloresz JocelynFloresz changed the title fix(useDateFormat): can't return 0 when the day is sunday and formatStr is 'd' useDateFormat: can't return 0 when the day is sunday and formatStr is 'd' Jul 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment