xdate - a modern java-script date library

10
XDate A Modern JavaScript Date Library Albert Guo 2012/12/06

Upload: guo-albert

Post on 19-May-2015

726 views

Category:

Documents


0 download

DESCRIPTION

XDate is a thin wrapper around JavaScript's native Date object that provides enhanced functionality for parsing, formatting, and manipulating dates

TRANSCRIPT

Page 1: XDate -  a modern java-script date library

XDate

A Modern JavaScript Date Library

Albert Guo

2012/12/06

Page 2: XDate -  a modern java-script date library

2

Introduction• XDate is a thin wrapper around

JavaScript's native Date object that provides enhanced functionality for parsing, formatting, and manipulating dates. It implements the same methods as the native Date, so it should seem very familiar.

• Also, it is non-destructive to the DOM, so it can safely be included in third party libraries without fear of side effects.

Page 3: XDate -  a modern java-script date library

3

Where to download• http://arshaw.com/xdate

Page 4: XDate -  a modern java-script date library

4

Requirements• 1. Straightforward to get current date and

format it • 2. Easy to do add days and get expected

result

Page 5: XDate -  a modern java-script date library

5

Prerequisite• Import xdate.js in <head></head>

Page 6: XDate -  a modern java-script date library

6

Straightforward to get current date and format it

Creates a new XDate with the

current date and time

Call toString to do formatting

Page 7: XDate -  a modern java-script date library

7

Straightforward to get current date and format it – cont.

html

JS function

Page 8: XDate -  a modern java-script date library

8

Easy to do add days and get expected result

Creates a new XDate with the

current date and time

Call adding method

8

Page 9: XDate -  a modern java-script date library

9

Easy to do add days and get expected result – cont.

2012/12/6 + 30 days

Page 10: XDate -  a modern java-script date library

10

Easy to do add days and get expected result – cont.

HTML

JS function