Skip to content
New issue

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

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

Already on GitHub? # to your account

[Bug] Week seems to be locale dependant, but should always be ISO 8601 compliant #71

Open
Sector6759 opened this issue Nov 8, 2024 · 0 comments

Comments

@Sector6759
Copy link

Sector6759 commented Nov 8, 2024

Vue2-datepicker version: 1.0.3
Vue version: 3.5.12
Browser: Chrome 130.0.6723.116

Steps to reproduce

  1. Import a locale which does not use monday as the first day of week
  2. Create a DatePicker with type="week"
  3. Open the DatePicker and select the first day, e.g. Sunday if using the en locale
  4. Observe the number inside the input

Reproduction Link or Source Code

<template>
  <DatePicker v-model:value="foo" type="week" :show-week-number="true" />
</template>
<script setup lang="ts">
import { ref } from 'vue'
import DatePicker from 'vue-datepicker-next'
import 'vue-datepicker-next/index.css'
import 'vue-datepicker-next/locale/en'
const foo = ref()
</script>

Expected behavior

IMHO, if using a DatePicker with type="week", the displayed week number should always be ISO 8601 compliant, i.e. weeks start on monday, even if the popup renders any other weekday as the first day of week.

Basically, I expect this DatePicker to behave as the native <input type="week">, which is sadly not supported by Firefox and Safari.

As you can see in this screenshot, according to my browser locale, which is en-US, Chrome renders the popup of the native input elements with sunday as the first day of week, but it shows that the range of a single week is from monday to sunday.

Untitled

Actual behavior

Selecting a locale which does not use monday as the first day of week, e.g. en, changes the displayed week number when selecting this locale specific first day of week compared to locales which use monday as the first day of week.

In the following screenshot, I select Sunday December 29, which results in week number 1 being displayed, but according to ISO 8601, that date is in week 52 (of 2024).

Untitled2

@Sector6759 Sector6759 changed the title [Bug] Week seems to be locale dependant, but should always be ISO8061 compliant [Bug] Week seems to be locale dependant, but should always be ISO 8061 compliant Nov 8, 2024
@Sector6759 Sector6759 changed the title [Bug] Week seems to be locale dependant, but should always be ISO 8061 compliant [Bug] Week seems to be locale dependant, but should always be ISO 8601 compliant Nov 8, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant