Constructor
new DateString(value)
A String whose value is a valid representation of a Date.
Use this type if you need to preserve the format of the value and still
check if it's valid.
Example:
```js
var loopback = require('loopback');
var dt = new loopback.DateString('2001-01-01');
dt.toString();
// '2001-01-01'
dt._date.toISOString();
// '2001-01-01T00:00:00.000Z'
```
You can use this definition on your models as well:
```json
{
"name": "Person",
"base": "PersistedModel",
"properties": {
"name": {
"type": "string"
},
"dob": {
"type": "DateString",
"required": true
},
},
"validations": [],
"relations": {},
"acls": [],
"methods": {}
}
```
Parameters:
Name | Type | Description |
---|---|---|
value |
String |
- Source:
Methods
toJSON() → {String}
Returns the JSON representation of the DateString object.
- Source:
Returns:
A JSON string.
- Type
- String
toString() → {String}
Returns the value of DateString in its original form.
- Source:
Returns:
The Date as a String.
- Type
- String