parent
2ead72c552
commit
ab30692021
3 changed files with 40 additions and 6 deletions
|
@ -7,9 +7,9 @@ const { Model, attr, belongsTo, hasMany } = DS;
|
||||||
export default Model.extend({
|
export default Model.extend({
|
||||||
displayName: attr('string'),
|
displayName: attr('string'),
|
||||||
numberOfTraps: attr('number'),
|
numberOfTraps: attr('number'),
|
||||||
collectionStartDate: attr('string-null-to-empty'),
|
collectionStartDate: attr('ccdb-date'),
|
||||||
collectionStartTime: attr('string-null-to-empty'),
|
collectionStartTime: attr('string-null-to-empty'),
|
||||||
collectionEndDate: attr('string-null-to-empty'),
|
collectionEndDate: attr('ccdb-date'),
|
||||||
collectionEndTime: attr('string-null-to-empty'),
|
collectionEndTime: attr('string-null-to-empty'),
|
||||||
notes: attr('string'),
|
notes: attr('string'),
|
||||||
|
|
||||||
|
|
|
@ -79,19 +79,35 @@
|
||||||
{{/validated-field}}
|
{{/validated-field}}
|
||||||
|
|
||||||
{{#validated-field property='collectionStartDate' label='Collection start date' changeset=changeset}}
|
{{#validated-field property='collectionStartDate' label='Collection start date' changeset=changeset}}
|
||||||
{{input value=changeset.collectionStartDate type='date' class='form-control'}}
|
{{
|
||||||
|
pikaday-input
|
||||||
|
onSelection=(action (mut changeset.collectionStartDate))
|
||||||
|
value=changeset.collectionStartDate
|
||||||
|
useUTC=true
|
||||||
|
placeholder='MM/DD/YYYY'
|
||||||
|
format='MM/DD/YYYY'
|
||||||
|
class='form-control'
|
||||||
|
}}
|
||||||
{{/validated-field}}
|
{{/validated-field}}
|
||||||
|
|
||||||
{{#validated-field property='collectionStartTime' label='Collection start time' changeset=changeset}}
|
{{#validated-field property='collectionStartTime' label='Collection start time' changeset=changeset}}
|
||||||
{{input value=changeset.collectionStartTime type='time' class='form-control'}}
|
{{input value=changeset.collectionStartTime type='time' class='form-control' placeholder='HH:MM:SS (24 hour)'}}
|
||||||
{{/validated-field}}
|
{{/validated-field}}
|
||||||
|
|
||||||
{{#validated-field property='collectionEndDate' label='Collection end date' changeset=changeset}}
|
{{#validated-field property='collectionEndDate' label='Collection end date' changeset=changeset}}
|
||||||
{{input value=changeset.collectionEndDate type='date' class='form-control'}}
|
{{
|
||||||
|
pikaday-input
|
||||||
|
onSelection=(action (mut changeset.collectionEndDate))
|
||||||
|
value=changeset.collectionEndDate
|
||||||
|
useUTC=true
|
||||||
|
placeholder='MM/DD/YYYY'
|
||||||
|
format='MM/DD/YYYY'
|
||||||
|
class='form-control'
|
||||||
|
}}
|
||||||
{{/validated-field}}
|
{{/validated-field}}
|
||||||
|
|
||||||
{{#validated-field property='collectionEndTime' label='Collection end time' changeset=changeset}}
|
{{#validated-field property='collectionEndTime' label='Collection end time' changeset=changeset}}
|
||||||
{{input value=changeset.collectionEndTime type='time' class='form-control'}}
|
{{input value=changeset.collectionEndTime type='time' class='form-control' placeholder='HH:MM:SS (24 hour)'}}
|
||||||
{{/validated-field}}
|
{{/validated-field}}
|
||||||
{{/with}}
|
{{/with}}
|
||||||
{{/f.content}}
|
{{/f.content}}
|
||||||
|
|
18
app/transforms/ccdb-date.js
Normal file
18
app/transforms/ccdb-date.js
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
import DS from 'ember-data';
|
||||||
|
|
||||||
|
export default DS.Transform.extend({
|
||||||
|
deserialize(serialized) {
|
||||||
|
return serialized || '';
|
||||||
|
},
|
||||||
|
|
||||||
|
serialize(date) {
|
||||||
|
if (date !== '') {
|
||||||
|
const day = date.getDate();
|
||||||
|
const month = date.getMonth() + 1;
|
||||||
|
const year = date.getFullYear();
|
||||||
|
return `${year}-${month}-${day}`;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
Loading…
Add table
Reference in a new issue