Giter Club home page Giter Club logo

datejs's Introduction

Overview

Datejs is an open source JavaScript Date library for parsing, formatting and processing.

The last official release was Alpha-1 on November 19th, 2007. The project has been mostly dormant since that early release.

Getting Started

We recommend including one of the .js files from within the /build/ folder.

<script type="text/javascript" src="date.js"></script>

Within the /build/ folder, a date.js file has been created for each of the 150+ supported Cultures. Changing the Culture of the library is as easy as changing the date.js file.

<!-- Set the CultureInfo to de-DE (German/Deutsch) -->
<script type="text/javascript" src="date-de-DE.js"></script>

Before minification, the Datejs library is contained in six (6) separate JavaScript files. Each of the files can be included individually.

The following is a list of precedence if including the files individually. Each file requires the one above it. For example, core.js requires a CultureInfo file.

1. CultureInfo       Contains all Globalized strings and culture specific properties.
                     Debug versions available within the /src/globalization/ folder.
2. core.js           All core Date processing logic.
3. parser.js         All parsing logic.
4. sugarpak.js*      All syntactical sugar.
5. time.js**         TimeSpan and TimePeriod classes.
6. extras.js**       PHP/Unix date format conversion functions.

*  The parser.js file is not required for sugarpak.js
** The time.js and extras.js files are optional and are not included in the compiled /build/ versions.

Example Usage

Syntax Overview

Date.today()                    // Returns today's date, with time set to 00:00 (start of day).

Date.today().next().friday()    // Returns the date of the next Friday.
Date.today().last().monday()    // Returns the date of the previous Monday.

new Date().next().march()       // Returns the date of the next March.
new Date().last().week()        // Returns the date one week ago. 

Date.today().is().friday()      // Returns true|false if the day-of-week matches.
Date.today().is().fri()         // Abbreviated day names. 

Date.today().is().november()    // Month names.
Date.today().is().nov()         // Abbreviated month names.

Date.today().is().weekday()     // Is today a weekday?

Date.today().addDays(1)         // Add one day (+1).
Date.today().addMonths(-3)      // Subtract three months (-3).

Date.today().add(1).day()       // Add one (+1) day. Supports all date parts (year, month, day, hour, minute, second, millisecond, and weeks)
Date.today().add(-3).months()   // Subtract three (-3) months.

(1).day().fromNow()             // One (1) day from now. 
(3).months().ago()              // Three (3) months ago.

var n = 6;
n.months().fromNow()            // Six (6) months from now.

Date.monday()                   // Returns Monday of the current week.
Date.mon()                      // Abbreviated version of Date.monday()

Date.march()                    // Returns March 1st of this year.
Date.mar()                      // Abbreviated version of Date.march()

Date.today().first().thursday() // Returns the first Thursday of the current month.
Date.today().second().thursday()// Returns the second Thursday of the current month.

Date.march().third().thursday() // Returns the third Thursday in March of the current year.
Date.october().fourth().sunday()// Returns the fourth Sunday in October.

Date.today().fifth().sunday()   // Returns the fifth Sunday in the current month, or throws a RangeError exception if there are not 5 Sundays in the current month.
Date.october().final().sunday() // Returns the final Sunday in October.

Date.january().first().monday() // Returns the first Monday of the current year.
Date.december().final().friday()// Returns the last Friday of the current year.

Date.today().at("6:15pm");      // Returns todays date at 6:15pm.

var time = {hour:18, minute:15};
Date.today().at(time);          // Set time with a config object.

var birthDayParty = {month: 1, day: 20, hour: 20, minute: 30};
Date.today().set(birthDayParty);// Set date and time with a config object.

Parsing

The following list is only a small subset of hundreds of string formats which can be parsed correctly without providing a date format. All parsing is fully Globalized by including the appropriate CultureInfo file. The CultureInfo file contains all the strings used for parsing and formatting.

All CultureInfo files can be found in the /trunk/source/globalization/ folder.

The following .parse() samples use the en-US.js CultureInfo file.

Date.parse("t")                 // Returns today's date.
Date.parse("today")             // Returns today's date.
Date.parse("tomorrow")          // Returns tomorrow's date.
Date.parse("yesterday")         // Returns yesterday's date.

Date.parse("next friday")       // Returns the date of the next Friday.
Date.parse("last monday")       // Returns the date of the previous Monday.

Date.parse("July 8th, 2004")    // Thu Jul 08 2004
Date.parse("15-Jan-2004")       // Thu Jan 15 2004

Date.parse("7/1/2004")          // Thu Jul 01 2004
Date.parse("7.1.2004")          // Thu Jul 01 2004
Date.parse("07.15.04")          // Thu Jul 15 2004

Date.parse("July 23rd 2004")    // Fri Jul 23 2004
Date.parse("Sat July 3, 2004")  // Sat Jul 03 2004

Date.parse("10:30 PM EST")      // Wed Oct 31 2007 20:30:00
Date.parse("10PM")              // Wed Oct 31 2007 22:00:00

Date.parse("t + 5d")            // Adds 5 days to today.
Date.parse("today - 1 month")   // Subtracts 1 month from today.

Date.parse("+")                 // Add 1 day to today = tomorrow.
Date.parse("- 3months")         // Subtract 3 months.

Date.parse("+1year")            // Add a year to today.
Date.parse("-12 months")        // Subtract 12 months (1 year) from today.

Date.parse("July 4th")          // July 4th of this year.
Date.parse("15")                // 15th day of current month/year.

Date.parse("July 8th, 2004, 10:30 PM")      // Thu Jul 08 2004 22:30:00
Date.parse("2004-07-15T06:45:00")           // Thu Jul 15 2004 06:45:00
Date.parse("Thu, 1 July 2004 22:30:00 GMT") // Thu Jul 01 2004 16:30:00

Date.parse("1997-07-16T19:20:15")           // ISO 8601 Formats
Date.parse("1997-07-16T19:20:30+01:00")     // ISO 8601 with Timezone offset
Date.parse("1985-04-12T23:20:50Z")          // RFC 3339 Formats

Chaining

Date.today().add({ months: 1, days: 5 }).is().fri()        // Add 1 month and 5 days, then check if that date is a Friday.
Date.parse("10-July-2004").next().friday().add(-1).month() // Take in a date, then move to the next Friday and subtract a month.

Comparison

Date.today().equals( Date.parse("today"))                  // true|false
Date.parse("last Tues").equals(Date.today())               // true|false

Date.equals(Date.today(), Date.parse("today"))             // true|false
Date.compare(Date.today(), Date.parse("today"))            // 1 = greater, -1 = less than, 

Date.today().compareTo(Date.parse("yesterday"))            // 1 = greater, -1 = less than, 0 = equal
Date.today().between(startDate, endDate)                   // true|false

Converting to String

Note The format parameter is optional with the .toString() function. If no format is provided, the native JavaScript Date .toString() function will be called.

A detailed list of supported FormatSpecifiers is listed in the Format Specifiers page on the wiki.

Standard Date and Time Format Specifiers

Format Description Example
s The seconds of the minute between 0-59. 0 to 59
ss The seconds of the minute with leading zero if required. 00 to 59
m The minute of the hour between 0-59. 0 or 59
mm The minute of the hour with leading zero if required. 00 to 59
h The hour of the day between 1-12. 1 to 12
hh The hour of the day with leading zero if required. 01 to 12
H The hour of the day between 0-23. 0 to 23
HH The hour of the day with leading zero if required. 00 to 23
d The day of the month between 1 and 31. 1 to 31
dd The day of the month with leading zero if required. 01 to 31
ddd Abbreviated day name. Date.CultureInfo.abbreviatedDayNames. Mon to Sun
dddd The full day name. Date.CultureInfo.dayNames. Monday to Sunday
M The month of the year between 1-12. 1 to 12
MM The month of the year with leading zero if required. 01 to 12
MMM Abbreviated month name. Date.CultureInfo.abbreviatedMonthNames. Jan to Dec
MMMM The full month name. Date.CultureInfo.monthNames. January to December
yy Displays the year as a two-digit number. 99 or 07
yyyy Displays the full four digit year. 1999 or 2007
t Displays the first character of the A.M./P.M. designator. Date.CultureInfo.amDesignator or Date.CultureInfo.pmDesignator A or P
tt Displays the A.M./P.M. designator. Date.CultureInfo.amDesignator or Date.CultureInfo.pmDesignator AM or PM
S The ordinal suffix of the current day. st, nd, rd, or th

Custom Date and Time Format Specifiers

Format Description Example
d The CultureInfo shortDate Format Pattern M/d/yyyy
D The CultureInfo longDate Format Pattern dddd, MMMM dd, yyyy
F The CultureInfo fullDateTime Format Pattern dddd, MMMM dd, yyyy h:mm:ss tt
m The CultureInfo monthDay Format Pattern MMMM dd
r The CultureInfo rfc1123 Format Pattern ddd, dd MMM yyyy HH:mm:ss GMT
s The CultureInfo sortableDateTime Format Pattern yyyy-MM-ddTHH:mm:ss
t The CultureInfo shortTime Format Pattern h:mm tt
T The CultureInfo longTime Format Pattern h:mm:ss tt
u The CultureInfo universalSortableDateTime Format Pattern yyyy-MM-dd HH:mm:ssZ
y The CultureInfo yearMonth Format Pattern MMMM, yyyy

Separator Characters

Character Name
/ forward slash
space
. period
- hyphen
, comma
new Date().toString()                  // "Wed Oct 31 2007 16:18:10 GMT-0700 (Pacfic Daylight Time)"
new Date().toString("M/d/yyyy")        // "10/31/2007"

Date.today().toString("d-MMM-yyyy")    // "31-Oct-2007"
new Date().toString("HH:mm")           // "16:18"

Date.today().toString("MMMM dS, yyyy") // "April 12th, 2008"

Date.today().toShortDateString()       // "10/31/2007". Culture specific as per Date.CultureInfo.shortDatePattern.
Date.today().toLongDateString()        // "Wednesday, October 31, 2007". Culture specific as per Date.CultureInfo.longDatePattern.

new Date().toShortTimeString()         // "4:18 PM". Culture specific as per Date.CultureInfo.shortTimePattern.
new Date().toLongTimeString()          // "4:18:34 PM". Culture specific as per Date.CultureInfo.longTimePattern.

Core

Date.today().set({ day: 15 })          // Sets the day to the 15th of the current month and year. Other object values include year|month|day|hour|minute|second.
Date.today().set({ year: 2007, month: 1, day: 20 })

Date.today().add({ days: 2 })          // Adds 2 days to the Date. Other object values include year|month|day|hour|minute|second.
Date.today().add({ years: -1, months: 6, hours: 3 })
Date.today().addYears(1)               // Adds 1 year.
Date.today().addMonths(-2)             // Subtracts 2 months.
Date.today().addWeeks(1)               // Adds 1 week.
Date.today().addDays(4)                // Adds 4 days.
Date.today().addHours(6)               // Adds 6 hours.
Date.today().addMinutes(-30)           // Subtracts 30 minutes.
Date.today().addSeconds(15)            // Adds 15 seconds.
Date.today().addMilliseconds(200)      // Adds 200 milliseconds.

Date.today().moveToFirstDayOfMonth()   // Returns the first day of the current month.
Date.today().moveToLastDayOfMonth()    // Returns the last day of the current month.

new Date().clearTime()                 // Sets the time to 00:00 (start of the day).
Date.today().setTimeToNow()            // Resets the time to the current time (now). The functional opposite of .clearTime()

ISO 8601

// Parse ISO 8601 string
Date.parse("\"1997-07-16T19:20:15\"")  // ISO 8601 string format with wrapping double-quotes

// Convert date to ISO 8601 string
new Date().toISOString()               // Returns ISO 8601 string of date converted to it's UTC value. "2007-10-31T16:18:00Z"

// Get UTC converted ISO week number
Date.today().getISOWeek()              // Returns ISO 8601 week of year. Returns "01" to ("52" | "53") depending on the year. See also .getWeek()

Misc

Date.getMonthNumberFromName("March")   // 2 - CultureInfo specific. <static>
Date.getDayNumberFromName("sat")       // 6 - CultureInfo specific. <static>

Date.isLeapYear(2008)                  // true|false. <static>
Date.getDaysInMonth(2007, 9)           // 31 <static>

Date.today().getWeek()                 // Returns week of year. Returns 1 to (52 | 53) depending on the year
Date.today().setWeek(1)                // Sets the week of the year to the Monday of the week set.

var test = new Date();                 // Do something... like run a test...
test.getElapsed()                      // Returns millisecond difference from now.

Date.today().isDaylightSavingTime()    // true|false. Is within the Daylight Saving Time.
Date.today().hasDaylightSavingTime()   // true|false. Is Daylight Saving Time observed.

datejs's People

Contributors

alqfahad avatar attaboy avatar claudioweiler avatar dependabot-preview[bot] avatar geoffreymcgill avatar imehdihosseini avatar kaelwd avatar leonardobazico avatar mohammedbelkacem avatar mquy avatar neugierdsnase avatar samb avatar sibstephen avatar thomastrethan avatar vovafeldman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

datejs's Issues

Feature Request - Add Business Days

From @GoogleCodeExporter on April 18, 2015 5:51

Feature to add business days excluding weekends

For Instance

Date.today().next().thursday().add(2).weekdays()

Should return next monday instead of saturday.

Location specific versions would be aware of the weekend days for the locale.

Though much higher in scope, ability to setup a list of holidays from an
xml or json url would be nice. 

Original issue reported on code.google.com by [email protected] on 27 Apr 2009 at 2:09

Copied from original issue: #72

en-GB parses some long dates incorrectly

From @GoogleCodeExporter on April 18, 2015 5:51

What steps will reproduce the problem?
1. use date-en-GB.js
2. var bad = Date.parse('03 Aug 2009');

What is the expected output? 
> Mon Aug 03 2009 
What do you see instead?
> Sat Aug 01 2009 

What version of the product are you using? On what operating system?
Version: 1.0 Alpha-1 on firefox

Please provide any additional information below.

All formats in dd MMM yyyy format work okay e.g. '03 Jan 2009', '03 January
2009'.. 

The only ones that don't are dd Apr yyyy, dd April yyyy, dd Aug yyyy. dd
August yyyy e.g.
Date.parse('03 Apr 2009') -> 01 Apr 2009

I wonder if it's related to the letter A at the start of the month name? It
seems that when the month name starts with an 'A' the day part of the date
is ignored.




Original issue reported on code.google.com by [email protected] on 5 Aug 2009 at 1:24

Copied from original issue: #81

How do you build it?

There's no any docs on how to build a globalized distribution. What source files do you need to include into the build?

Maybe you shouldn't even include the build directory into the repository.

setWeek patch

From @GoogleCodeExporter on April 18, 2015 5:51

Hi

I've run into a small bug with setWeek.

My interpretation of how this function should work is: Move to the given
week in this year.
The current implementation does not take into consideration the case, when
the week is No. 1 but the month is December.

Why are you moving to the start of the week? If I need to move to some
arbitrary week and see what date the same dayofweek is I'll need to reset
the dayofweek.

I've created a patch to fix this issue

Original issue reported on code.google.com by [email protected] on 14 Jan 2009 at 10:33

Attachments:

Copied from original issue: #58

Unable to parseExact a string in a certain format

From @GoogleCodeExporter on April 18, 2015 5:50

I commented here - http://code.google.com/p/datejs/wiki/FormatSpecifiers - but 
realized that 
may not have been the right place.

I'm trying to parseExact a date string like "yyyy-MM-ddTHH:mm:ss.000-05:00" but 
the latter part 
(-05:00) breaks if it's a different time zone (-06:00) is present. I've tried 
using "P" (noted above) but 
no joy. I'm using trunk. I can't change the format... google calendar RSS. :)

I've also tried using just "c", but the presence of milliseconds in the string 
breaks it.

Anything I can try?

Original issue reported on code.google.com by [email protected] on 24 May 2008 at 3:30

Copied from original issue: #41

ParseExact treats UTC offset as time

From @GoogleCodeExporter on April 18, 2015 5:51

What steps will reproduce the problem?
1. ParseExact("2009-03-05T23:00:00-08:00","yyyy-MM-ddTHH:mm:ss-hh:mm")
2.
3.

What is the expected output? What do you see instead?
Returns a time of 08:00 (Thu Mar 5 08:00 PST 2009).  Offset being parsed 
as the time.

What version of the product are you using? On what operating system?
Windows XP SP. IE 6.  Version: 1.0 Alpha-1

Please provide any additional information below.

Original issue reported on code.google.com by [email protected] on 5 Mar 2009 at 7:42

Copied from original issue: #65

toISOString() only works in Firefox

From @GoogleCodeExporter on April 18, 2015 5:51

What steps will reproduce the problem?
var d = new Date().toISOString();
alert(d);

What is the expected output? What do you see instead?
2009-08-06T23:59:44.535Z
JavaScript error

What version of the product are you using? On what operating system?
Internet Explorer 8, Opera 9.64, Google Chrome 2.0.172.39 and Safari 4.0.2 
on Vista.

Please provide any additional information below.

Message: Object doesn't support this property or method

Original issue reported on code.google.com by [email protected] on 7 Aug 2009 at 12:07

Copied from original issue: #82

strange regex problem?

From @GoogleCodeExporter on April 18, 2015 5:51

What steps will reproduce the problem?

Im try to modify date.js to change keyword "now" and add "teraz" (mean now
in Polish) so I made a change: 

now:/^n(ow)?|teraz/i

and tested like this:

Date.parse("now")   OK
Date.parse("teraz") FAIL

...and ended with null :( 

but when change to:

now:/^n(ow)?|xeraz/i
Date.parse("xeraz") OK

I have tested also:

now:/^teraz/i
Date.parse("teraz") FAIL

so the "t" char on the beginning is a problem, but why "today" works?


What version of the product are you using? On what operating system?

current date.js, IE and FF on XP


Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 4 Feb 2009 at 2:25

Copied from original issue: #62

Default To First Of Month tests fails if using dateElementOrder="dmy"

From @GoogleCodeExporter on April 18, 2015 5:51

What steps will reproduce the problem?
1. change dateElementOrder: "dmy"
2. run tests partial / "No Day: Default To First Of Month"
3.

What is the expected output? What do you see instead?
dates like Jan 2008 and January 2008 still pass but dates like 1/2008, 1
2008, 1-2008, 2008/1, 2008 1, 2008/1 all fail
see
http://blog.osmeusapontamentos.com/datejs-all/test/partial/index-pt-PT.html
for all tests with pt-PT localized version

What version of the product are you using? On what operating system?
build 159. windows vista english

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 24 Dec 2008 at 12:22

Attachments:

Copied from original issue: #56

Date.parse('+100') fails

From @GoogleCodeExporter on April 18, 2015 5:50

The parser does not accept 3 (or more) character math numbers.

Example

Date.parse('+100'); // fail


Original issue reported on code.google.com by geoff on 29 Nov 2007 at 12:22

Copied from original issue: #20

Unable to parseExact a string in a certain format

From @GoogleCodeExporter on April 18, 2015 5:50

I commented here - http://code.google.com/p/datejs/wiki/FormatSpecifiers - but 
realized that 
may not have been the right place.

I'm trying to parseExact a date string like "yyyy-MM-ddTHH:mm:ss.000-05:00" but 
the latter part 
(-05:00) breaks if it's a different time zone (-06:00) is present. I've tried 
using "P" (noted above) but 
no joy. I'm using trunk. I can't change the format... google calendar RSS. :)

I've also tried using just "c", but the presence of milliseconds in the string 
breaks it.

Anything I can try?

Original issue reported on code.google.com by [email protected] on 24 May 2008 at 3:30

Copied from original issue: #41

Date additions unreliable in Safari 2

From @GoogleCodeExporter on April 18, 2015 5:50

Safari 2's implementation of Date#setDate uses a signed byte integer which
means large values will get 'rolled over' and return an incorrect value
unless the add/subtracts are called in increments. The following link
details this bug which affects the addition methods that use setDate. This
issue does not affect Safari 3.

http://brianary.blogspot.com/2006/03/safari-date-bug.html

I tested using the version installed at http://www.datejs.com/

Original issue reported on code.google.com by [email protected] on 28 Nov 2007 at 2:59

Copied from original issue: #12

Parsed string to date rendered inconsistently by toString() in some browsers

From @GoogleCodeExporter on April 18, 2015 5:50

I'm parsing dates from "yyyy-MM-ddTHH:mm:ss-05:00" format and then 
toString()'ing them.

I'm being told that some folks were seeing strange dates as a result, so I 
fired up Parallels and 
MSIE6 and sure enough, they we weird. Hours off.

I checked the system time and *it* was way off. Set it. Quit and re-opened MSIE 
and all was well.

So I can envision a way to say "hey, buddy, your clock's off, so these dates 
might be too," but 
what's bugging me is why is it that a specific date being read in and then 
printed out is affected 
by the system's time settings?

Is there a way to override this? Maybe some kind of Date.setBaseTime() or 
Date.setTimeZone()?

You may or may not be able to see this in action here...
  http://www.redeemerbaptist.org/

...using a WordPress plug-in I'm attempting to make here...
  http://code.google.com/p/wp-gcal-rss/

Whining aside, thanks for a great tool!

Original issue reported on code.google.com by [email protected] on 4 Jun 2008 at 1:20

Copied from original issue: #42

CultureInfo: Some Month Names of German and French Translations Do Not Deliver Correct Result

From @GoogleCodeExporter on April 18, 2015 5:51

What steps will reproduce the problem?
1. Use either the de-DE or the fr-FR translation.
2. Try the German month names "Oktober" or "Dezember" or any of the French 
month names.
3. The parse function will return the current month.

What is the expected output? What do you see instead?
The specified month.

What version of the product are you using? On what operating system?
Latest downloadable version on WXP SP3.

Please provide any additional information below.

---

Original issue reported on code.google.com by [email protected] on 15 May 2009 at 8:03

Copied from original issue: #74

Formatting month is not consistent with documentation

The docs state:

MMM Abbreviated month name. Date.CultureInfo.abbreviatedMonthNames. "Jan" to "Dec"
MMMM The full month name. Date.CultureInfo.monthNames. "January" to "December"

While the result is the exact opposite of these two options.

Order of formats in Date.parseExact()?

From @GoogleCodeExporter on April 18, 2015 5:50

Seems to be a problem in .parseExact() somewhere, or maybe it's in
Parser.finishExact. For example...

// returns null
Date.parseExact("November 2007", ["MMMM d", "MMMM yyyy"]);

// Switch the format order, and a valid date is returned
Date.parseExact("November 2007", ["MMMM yyyy", "MMMM d"]);

Original issue reported on code.google.com by geoff on 26 Nov 2007 at 6:10

Copied from original issue: #8

CultureInfo: Month Names With Accents Cannot Be Parsed

From @GoogleCodeExporter on April 18, 2015 5:51

What steps will reproduce the problem?
1. Use a translation which has month names with accents, e.g. de-DE or fr-
FR
2. Try to parse a month name with accents like "März" or "Février"
3. The parse function returns an error.

What is the expected output? What do you see instead?
The expected date would be correct month.

What version of the product are you using? On what operating system?
Latest downloadable version on WXP SP3.

Please provide any additional information below.

---

Original issue reported on code.google.com by [email protected] on 15 May 2009 at 7:59

Copied from original issue: #73

"monday +2week" equivalent to "+2days"

From @GoogleCodeExporter on April 18, 2015 5:50

What steps will reproduce the problem?
1. Type "monday +2week"

What is the expected output? What do you see instead?
Expected output: ideally, two weeks from the following monday (although
given a previous issue I've raised, even "monday" or "+2week" would be
*more* expected; "+2 days" is just bizarre.

What version of the product are you using? On what operating system?
Firefox 2, OS X 10.5.1

Original issue reported on code.google.com by [email protected] on 28 Nov 2007 at 8:35

Copied from original issue: #16

Incorrect ISO 8601 with Timezone offset Date Parsing.

From @GoogleCodeExporter on April 18, 2015 5:51

What steps will reproduce the problem?
1. Date.parse('1997-07-16T19:20:30+00:00').toISOString() !=
"1997-07-16T10:20:30Z"
2. '+00:00' is not recognized as UTC but as timezone of current machine.

What version of the product are you using? On what operating system?

- svn version


Original issue reported on code.google.com by [email protected] on 23 Jan 2009 at 4:04

Copied from original issue: #59

Date.parse() works differently on different browsers

From @GoogleCodeExporter on April 18, 2015 5:50

What steps will reproduce the problem?
1. Open your homepage in IE7 and Firefox2 on a thur, fri or sat
2. Type 'wednesday' in Mad Skillz.. demo box
3. IE7 shows May 14, Firefox show May 7.

Same issue for 'today', 'sun.. sat', 'last ...', etc.

Safari works like Firefox. I don't know about IE6 yet.

What is the expected output? What do you see instead?
The same date on all browsers. Different dates depending on the browser.

What version of the product are you using? On what operating system?
 * Version: 1.0 Alpha-1 
 * Build Date: 13-Nov-2007


Original issue reported on code.google.com by [email protected] on 11 May 2008 at 2:58

Copied from original issue: #40

getWeek() returning wrong week number

From @GoogleCodeExporter on April 18, 2015 5:51

What steps will reproduce the problem?

Date.parse('2009-02-23').getWeek()

What is the expected output? What do you see instead?

Expected: 10, returned: 9

What version of the product are you using? On what operating system?

SVN/any browser/Linux

Original issue reported on code.google.com by [email protected] on 26 Mar 2009 at 5:28

Copied from original issue: #66

Does not read ISO8601

Does not appear to read the ISO8601 format, this should be one of the most important features. I would work on it but nobody can tell me how to commit submodules and so I am the only person who can use my copies of my repos 👎

ISO8601 ie 2014-11-19T23:04:24.740Z

CultureInfo: regexPatterns for pt-PT

From @GoogleCodeExporter on April 18, 2015 5:51

based on pt-BR with the following changes:
- removed special characters like &ccedil; and &aacute;
- translated some regexPatterns: future, past, add, subtract, yesterday,
today, tomorrow, now, millisecond, second, minute, hour, week, month, day, year
- changed some regexPatterns: sun, mon, tue, wed, thu, fri, sat

Original issue reported on code.google.com by [email protected] on 24 Dec 2008 at 12:29

Attachments:

Copied from original issue: #57

"yesterday week" returns equivalent to "next week"

From @GoogleCodeExporter on April 18, 2015 5:50

Date.parse("yesterday week").equals(Date.parse("next week")); //
[PASS]which is not good

The following should pass...
Date.parse("yesterday week").equals(Date.parse("next week").add(-1).day());
// currently fails

This is a bit of known issue when combining Relative dates ("tomorrow")
with date math ("+week"). One hand is not talking to the other.

A fix is planned and should be available in the next release (Beta 1) of
the Parser.

Original issue reported on code.google.com by geoff on 27 Nov 2007 at 10:36

Copied from original issue: #9

Datejs should handle quoted strings in date formats

new Date().toString("'in English is' dddd")
"'in Engli122 i12' Monday"

LDML allows to quote literal strings, it is often useful to mix words with format data. This formatting should return

"in English is Monday"

Issue with French Translations

From @GoogleCodeExporter on April 18, 2015 5:51

What steps will reproduce the problem?
1. Use the French localization
2. Various shorthands do not work, some translations are not done.
3.

What is the expected output? What do you see instead?
I expect to get the full date form of the shorthand entered, I do not get
anything.

What version of the product are you using? On what operating system?
the latest version, operating system independent.

Please provide any additional information below.
The attached file resolves the issue.

Original issue reported on code.google.com by [email protected] on 8 Sep 2008 at 2:28

Attachments:

Copied from original issue: #45

0:00am == 0:00pm

From @GoogleCodeExporter on April 18, 2015 5:50

What steps will reproduce the problem?
var d1 = Date.parse("0:00am");
var d2 = Date.parse("0:00pm");
if(d1.getTime() == d2.getTime()) {
  alert("This shouldn't be");
}

What is the expected output? What do you see instead?
Either:
 * 0:00pm and 0:00am are rejected, or
 * 0:00am == 12:00am and 0:00pm == 12:00pm.

What version of the product are you using? On what operating system?
Using date-en-AU.js from SVN (r130) in Firefox 2.0.0.11 on Mac OS X 10.5.1

Please provide any additional information below.
I'm happy to be corrected on what 0:00am and 0:00pm mean, but it struck me as 
odd that these 
times were accepted.

Original issue reported on code.google.com by craig.e.anderson on 24 Jan 2008 at 6:07

Copied from original issue: #26

Stackoverflow in IE7 when _toString is called without any parameters

From @GoogleCodeExporter on April 18, 2015 5:51

What steps will reproduce the problem?
1. In IE7 call date.toString() without any format parameter
2. IE7 will report a stackoverflow
3.

What is the expected output? What do you see instead?
- A formatted date

What version of the product are you using? On what operating system?
- On a trunk version of datejs from 3/5/2009 and IE7 on windows vista

Please provide any additional information below.
- The YUI calendar control is storing a date inside of an object property.
When that is done on IE7, it seems to be calling an implicit .toString() on
the date object.

When this is done the _toString function defined in core.js gets into a
recurive loop and keeps going until a stackoverflow happens.

There should be some sort of default format or a way to not get into a
recursive loop.

Original issue reported on code.google.com by [email protected] on 5 Mar 2009 at 7:24

Copied from original issue: #64

Date.parse creating wrong day in month

From @GoogleCodeExporter on April 18, 2015 5:51

What steps will reproduce the problem?
1. Example date: "Mon Apr 20 20:05:30 +0000 2009"
2. var d = Date.parse(time);
// also, capital S does not produce the ordinal...
3. d.toString("h:mm tt MMM d") + d.getOrdinal();

What is the expected output?
8:42 AM Apr 20rd

What do you see instead?
7:42 AM Apr 23rd


What version of the product are you using? On what operating system?
latest version as of 4/20 on osx and win vista

The date above is one of 3, the first 2 work correctly (e.g. "Wed Apr 22
14:13:57 +0000 2009", "Tue Apr 21 17:29:36 +0000 2009"). Additionally,
these dates are part of the JSON from a twitter -
http://twitter.com/statuses/user_timeline.json

Original issue reported on code.google.com by rob.koberg on 23 Apr 2009 at 11:47

Copied from original issue: #71

date.parse( "3pm tomorrow" ) returns the date of tomorrow, 12:00:00 AM.

From @GoogleCodeExporter on April 18, 2015 5:51

What steps will reproduce the problem?

date.parse( "3pm tomorrow" ) // Done on 9/12/2008.


What is the expected output? What do you see instead?

Expected: Saturday, September 13, 2008 03:00:00 PM
Actual:   Saturday, September 13, 2008 12:00:00 AM
In other words, it's not bothering with the time portion of the english phrase.


What version of the product are you using? On what operating system?
FF3 / Windows XP.

Original issue reported on code.google.com by [email protected] on 12 Sep 2008 at 2:57

Copied from original issue: #46

Do not override Number.prototype

date.js adds properties to Number, which causes other libraries (d3.js being one) to crash because they do not expect that.

Examples :

running

(1)._dateElement
returns "day"

d3.js uses a for loop
for(k in a)
where a is sometimes a number, and the expected behavior is that the loop is not entered.

Incorrect ISO 8601 with Timezone offset Date Parsing.

From @GoogleCodeExporter on April 18, 2015 5:51

What steps will reproduce the problem?
1. Date.parse('1997-07-16T19:20:30+00:00').toISOString() !=
"1997-07-16T10:20:30Z"
2. '+00:00' is not recognized as UTC but as timezone of current machine.

What version of the product are you using? On what operating system?

- svn version


Original issue reported on code.google.com by [email protected] on 23 Jan 2009 at 4:04

Copied from original issue: #59

getWeek() returning wrong week number

From @GoogleCodeExporter on April 18, 2015 5:51

What steps will reproduce the problem?

Date.parse('2009-02-23').getWeek()

What is the expected output? What do you see instead?

Expected: 10, returned: 9

What version of the product are you using? On what operating system?

SVN/any browser/Linux

Original issue reported on code.google.com by [email protected] on 26 Mar 2009 at 5:28

Copied from original issue: #66

[Firefox 3.1] toISOString returns "2008-10-21T15:06:11.324Z" instead of ""2008-10-21T15:06:11.324Z""

From @GoogleCodeExporter on April 18, 2015 5:51

Note:
This issue relates to a nightly-build of Firefox 3.1, so it may not warrent
any action just yet since it could change again before the actual release
of 3.1. I'm posting it here though just in case though.


What steps will reproduce the problem?
1. Using Firefox 3.1b2pre (>= nightly build for 10-20-2008):
2. var d = new Date();
3. d.toISOString()

What is the expected output? What do you see instead?

expected:
~ ""2008-10-21T15:06:31Z""

see:
~ "2008-10-21T15:06:11.324Z"

What version of the product are you using? On what operating system?
Firefox 3.1b2pre (nightly build for 10-20-2008)

Please provide any additional information below.
This issue only started occurring in 3.1 as far as I know since the
10-20-2008 nightly build. The result of the switch is that some code used
to drop the extra quotation marks (slice(1,-1)) now drops important parts
of the date.

Original issue reported on code.google.com by [email protected] on 21 Oct 2008 at 3:13

Copied from original issue: #54

Date.parse does not parse timezone correctly when it is +0000

For example:

alert(new Date(Date.parse("Mon, 23 Jan 2012 21:10:41 GMT+0000"))); // Mon Jan 23 2012 21:10:41 GMT-0500 (EST)
alert(new Date(Date.parse("Mon, 23 Jan 2012 21:10:41 GMT-0001"))); // Mon Jan 23 2012 16:11:17 GMT-0500 (EST)
alert(new Date(Date.parse("Mon, 23 Jan 2012 21:10:41 GMT+0001"))); // Mon Jan 23 2012 16:10:05 GMT-0500 (EST)

Extras date.format issues

From @GoogleCodeExporter on April 18, 2015 5:51

In the UNIX Date.format function, several specifiers, e.g. j, %c result in
calls to t("d"), t("t") etc.  This is trapped by the "Standard Date and
Time Format Strings" block because it's a single-letter format string.

[SVN, Firefox 3.0]

Original issue reported on code.google.com by [email protected] on 31 Mar 2009 at 2:49

Copied from original issue: #68

[enhancement] Add missing bower.json.

Hey, maintainer(s) of datejs/Datejs!

We at VersionEye are working hard to keep up the quality of the bower's registry.

We just finished our initial analysis of the quality of the Bower.io registry:

7530 - registered packages, 224 of them doesnt exists anymore;

We analysed 7306 existing packages and 1070 of them don't have bower.json on the master branch ( that's where a Bower client pulls a data ).

Sadly, your library datejs/Datejs is one of them.

Can you spare 15 minutes to help us to make Bower better?

Just add a new file bower.json and change attributes.

{
  "name": "datejs/Datejs",
  "version": "1.0.0",
  "main": "path/to/main.css",
  "description": "please add it",
  "license": "Eclipse",
  "ignore": [
    ".jshintrc",
    "**/*.txt"
  ],
  "dependencies": {
    "<dependency_name>": "<semantic_version>",
    "<dependency_name>": "<Local_folder>",
    "<dependency_name>": "<package>"
  },
  "devDependencies": {
    "<test-framework-name>": "<version>"
  }
}

Read more about bower.json on the official spefication and nodejs semver library has great examples of proper versioning.

NB! Please validate your bower.json with jsonlint before commiting your updates.

Thank you!

Timo,
twitter: @versioneye
email: [email protected]
VersionEye - no more legacy software!

week issue

From @GoogleCodeExporter on April 18, 2015 5:51

What steps will reproduce the problem?
1. Date.today().set({week: 10}).getWeek();


What is the expected output? What do you see instead?

expected 10, returns 9

What version of the product are you using? On what operating system?

1.0 Alpha-1 2008-05-13 firefox linux

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 5 Jun 2009 at 3:55

Copied from original issue: #75

Syntactic sugar .fromNow() and .ago() don't work.

From @GoogleCodeExporter on April 18, 2015 5:51

What steps will reproduce the problem?
1. (2).minutes.fromNow()

What is the expected output? 

A time that is two minutes from now.

What do you see instead?

The current time.

What version of the product are you using? On what operating system?

date-en-US.js from svn.

Please provide any additional information below.

The date.js in the downloads section doesn't exhibit this behavior. But it has 
a different issue 
where Date.parse('12:00 PM') returns null.  All my testing is on Safari 4.

Thanks!
-Mat


Original issue reported on code.google.com by [email protected] on 17 Apr 2009 at 6:01

Copied from original issue: #69

firstDayOfWeek does not matter

I have some problem with Date.js library. I use the russian culture settings. First day of week is setted by 1. And it means, that my week should be since Monday till Sunday. Monday should be the return vaue when i call: Date.getDayNumberFromName('понедельник'); //Monday, it should return 0 and Date.getDayNumberFromName('воскресенье'); //Sunday, it should return 6

and, of course, it should be actual to all weeks calculations. For example, yesterday (Sunday, 3 March), this code: Date.monday(), should return 25 February. But it isn't so.

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.