Skip to content

format("z") should be 0-based #34

@mzilverberg

Description

@mzilverberg

PHP uses zero-based numbering for "z" in date formatting and returns values from 0 - 365. This library returns values from 1 - 366.
In my opinion, to fully mimic PHP, the function should end with a subtraction of 1:

(linebreaks added for readability)

z: function () { 
  var d = new Date(this.getFullYear(), 0, 1);
  return Math.ceil((this - d) / 86400000) - 1
},

Or was there a motivation to not used zero-based numbering here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions