Comparing version 0.0.3 to 0.1.0
@@ -5,2 +5,6 @@ # dafo Change Log | ||
## [0.1.0] - May 12th, 2019 | ||
* Utility function `dafo.parse()` added. | ||
## [0.0.1] - 2018-1-17 | ||
@@ -7,0 +11,0 @@ |
@@ -18,2 +18,3 @@ 'use strict'; | ||
isLeapYear : require('./isLeapYear'), | ||
parse : require('./parse'), | ||
}; |
@@ -14,3 +14,3 @@ { | ||
"name": "dafo", | ||
"version": "0.0.3", | ||
"version": "0.1.0", | ||
"main": "index.js", | ||
@@ -17,0 +17,0 @@ "keywords": [ |
@@ -9,4 +9,8 @@ # dafo | ||
## Table of contents | ||
## Description | ||
To format date in [PHP](#dafophp) or [MySQL](#dafomysql) style. | ||
## Table of Contents | ||
* [DISCLAIMER](#disclaimer) | ||
@@ -17,2 +21,3 @@ * [Get Started](#get-started) | ||
* [dafo/php](#dafophp) | ||
* [dafo.parse](#dafoparse) | ||
* [Others](#others) | ||
@@ -22,5 +27,2 @@ * [Why dafo](#why-dafo) | ||
* [References](#references) | ||
## Links | ||
* [CHANGE LOG](./CHANGELOG.md) | ||
@@ -175,2 +177,25 @@ * [Homepage](https://github.com/YounGoat/ecmascript.dafo) | ||
### dafo.parse | ||
```javascript | ||
const dafo = require('dafo'); | ||
// Get a Date object. | ||
let date = dafo.parse('2019.04.01', 'Y.m.d'); | ||
``` | ||
* Date __dafo.parse__(string *date*, string *format*) | ||
Argument *format* describes what and how makes up *date* string. Acceptable placeholders include: | ||
( Other characters are regarded as normal text. ) | ||
| Catergory | Example | Ch | Meaning | | ||
| :--------- | :---------------- | :---- | :------------------------------------------ | | ||
| Day | 01..31 | __d__ | day of the month | | ||
| Month | 01..12 | __m__ | month number | | ||
| Year | 0100, 1899, 2050 | __Y__ | year A.D. | | ||
| Time | 00..23 | __H__ | 24 hour | | ||
| Time | 00..59 | __i__ | minutes | | ||
| Time | 00..59 | __s__ | seconds | | ||
### Others | ||
@@ -201,2 +226,4 @@ | ||
* Date __dafo.parse__(string *date*, string *format*) | ||
### Week Mode | ||
@@ -206,12 +233,12 @@ | ||
| Mode | 1st weekday | Range | Week 1 is the first week ... | | ||
| :--- | :---------- | :---- | :---------------------------- | | ||
| Mode | 1st weekday | Range | Week 1 is the first week ... | Follows | | ||
| :--- | :---------- | :---- | :---------------------------- | :------ | | ||
| __0__ | Sunday | 0-53 | with a Sunday in this year | | ||
| __1__ | Monday | 0-53 | with 4 or more days this year | | ||
| __2__ | Sunday | 1-53 | with a Sunday in this year | | ||
| __3__ | Monday | 1-53 | with 4 or more days this year | | ||
| __3__ | Monday | 1-53 | with 4 or more days this year | ISO 8601 | | ||
| __4__ | Sunday | 0-53 | with 4 or more days this year | | ||
| __5__ | Monday | 0-53 | with a Monday in this year | | ||
| __6__ | Sunday | 1-53 | with 4 or more days this year | | ||
| __7__ | Monday | 1-53 | with a Monday in this year |å | ||
| __7__ | Monday | 1-53 | with a Monday in this year | | ||
@@ -230,2 +257,3 @@ | ||
* MySQL 5.7 Reference Manual > [Date and Time Functions](https://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html#function_date-format) | ||
* PHP Manual > [Date/Time Functions](http://php.net/manual/en/function.date.php) | ||
* PHP Manual > [Date/Time Functions](http://php.net/manual/en/function.date.php) | ||
* [Date and time format - ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) or WIKIPEDIA: [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) |
55202
24
1161
252