Skip to content

Commit

Permalink
hotfix patch hour format on store-hour format
Browse files Browse the repository at this point in the history
  • Loading branch information
roncodes committed Jan 10, 2022
1 parent fd21172 commit 86f4b99
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fleetbase/storefront",
"version": "1.1.2",
"version": "1.1.3",
"description": "Fleetbase Storefront JS & Node SDK",
"main": "dist/cjs/storefront.js",
"module": "dist/esm/storefront.js",
Expand Down
14 changes: 8 additions & 6 deletions src/resources/store-hour.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,23 @@ export default class StoreHour extends Resource {
return null;
}

const includesSeconds = this.getAttribute('start').split(':').length === 3;
const format = includesSeconds ? 'k:mm:ss' : 'k:mm';
const start = this.getAttribute('start');
const includesSeconds = start.split(':').length === 3;
const format = includesSeconds ? 'HH:mm:ss' : 'HH:mm';

return parse(this.getAttribute('start'), format, new Date());
return parse(start, format, new Date());
}

get endDateInstance() {
if (!this.hasAttribute('end')) {
return null;
}

const includesSeconds = this.getAttribute('end').split(':').length === 3;
const format = includesSeconds ? 'k:mm:ss' : 'k:mm';
const end = this.getAttribute('end');
const includesSeconds = end.split(':').length === 3;
const format = includesSeconds ? 'HH:mm:ss' : 'HH:mm';

return parse(this.getAttribute('end'), format, new Date());
return parse(end, format, new Date());
}

get humanReadableHours() {
Expand Down

0 comments on commit 86f4b99

Please sign in to comment.