GithubHelp home page GithubHelp logo

Comments (2)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 20, 2024
Totally agree. I'm going to rewrite .getWeekOfYear to follow ISO 8601. This 
should 
be added very soon.

I was not aware of the bug you noted above. Thanks for pointing it out.

Original comment by geoff%[email protected] on 28 Feb 2008 at 5:26

  • Changed state: Accepted

from datejs.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 20, 2024
The .getWeekOfYear function has been removed and replaced with the following 
two 
functions.

1. .getWeek() - Returns the week number. The first week of the year is the week 
which contains the first Thursday. Monday is considered the first day of the 
week.

Example

Date.today().getWeek();

2. .getISOWeek() - Converts the date to it's UTC value before getting week 
number.

Example

Date.today().getISOWeek();


I also added a .setWeek() function which moves the date to Monday of the week 
set.

Example

Date.today().setWeek(1); // set to the Monday of the first week of year


I also added "week" as a config option in .set().

Example

Date.today().set({week: 1}); // set to first week of year


Hope this helps.

Original comment by geoff%[email protected] on 6 Apr 2008 at 9:56

  • Changed title: [FIXED] getWeekOfYear is buggy and does not conform to ISO 8601:1988 (for locales using that flavor)
  • Changed state: Fixed

from datejs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.