Skip to content

Commit

Permalink
Merge pull request #12 from tomchkk/master
Browse files Browse the repository at this point in the history
Adds millisecond support
  • Loading branch information
michielfb authored Sep 12, 2022
2 parents 8b19943 + b10abab commit 97a80a1
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion dist/js/field.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion resources/js/components/DetailField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default {
computed: {
formattedDate() {
return this.field.value
? moment(this.field.value, 'HH:mm:ss').format(this.field.format)
? moment(this.field.value, this.field.format).format(this.field.format)
: '-';
}
}
Expand Down
4 changes: 0 additions & 4 deletions resources/js/components/FormField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
:step="field.step !== undefined ? field.step : false"
v-model="value"
/>

<p v-if="hasError" class="my-2 text-danger">
{{ firstError }}
</p>
</template>
</default-field>
</template>
Expand Down
4 changes: 2 additions & 2 deletions resources/js/components/IndexField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ export default {
computed: {
formattedDate() {
return this.field.value
? moment(this.field.value, 'HH:mm:ss').format(this.field.format)
? moment(this.field.value, this.field.format).format(this.field.format)
: '-';
}
}
}
</script>
</script>
9 changes: 7 additions & 2 deletions src/Time.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,16 @@ public function format(string $format = 'hh:mm A')
/**
* Set step attribute on time field.
*
* @param int $step
* For seconds:
* - use integers that will eventually reach 60 - e.g.: 1, 2, 10, 30
* For milliseconds:
* - use floats that eventually will reach 1 - e.g.: 0.001, 0.050, 0.200, etc.
*
* @param int|float $step
*
* @return $this
*/
public function withSteps(int $step)
public function withSteps($step)
{
return $this->withMeta([
'step' => $step
Expand Down

0 comments on commit 97a80a1

Please sign in to comment.