Skip to content

Commit

Permalink
Merge pull request #1227 from appwrite/fix-remove-seconds-time-inputs
Browse files Browse the repository at this point in the history
fix: remove seconds some time inputs
  • Loading branch information
ArmanNik committed Jul 31, 2024
2 parents 8afbdf5 + 33cdce7 commit e7d41b8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
7 changes: 6 additions & 1 deletion src/lib/components/filters/content.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,12 @@
bind:value />
{:else if column.type === 'datetime'}
{#key value}
<InputDateTime id="value" bind:value label="value" showLabel={false} />
<InputDateTime
id="value"
bind:value
label="value"
showLabel={false}
step={60} />
{/key}
{:else}
<InputText id="value" bind:value placeholder="Enter value" />
Expand Down
3 changes: 2 additions & 1 deletion src/lib/elements/forms/inputDateTime.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
export let readonly = false;
export let autofocus = false;
export let autocomplete = false;
export let step: number | 'any' = 0.001;
let element: HTMLInputElement;
let error: string;
Expand Down Expand Up @@ -70,7 +71,7 @@
{readonly}
{required}
{value}
step=".001"
{step}
autocomplete={autocomplete ? 'on' : 'off'}
type="datetime-local"
class="input-text"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
} from '$lib/helpers/date';
import { last } from '$lib/helpers/array';
let previousPage: string = base;
let previousPage: string = `${base}/project-${$page.params.project}/functions/function-${$page.params.function}/executions`;
afterNavigate(({ from }) => {
previousPage = from?.url?.pathname || previousPage;
Expand Down Expand Up @@ -126,10 +126,11 @@
let now = new Date();
let minDate: string;
let date: string = toLocaleDateISO(now.getTime());
let time: string = toLocaleTimeISO(now.getTime());
$: minDate = toLocaleDateISO(now.getTime());
// We need to remove seconds from the min so the seconds are not displayed in the time picker
let time: string = toLocaleTimeISO(now.getTime()).split(':').slice(0, 2).join(':');
$: minDate = toLocaleDateISO(now.toString());
$: minTime = isSameDay(new Date(date), new Date(minDate))
? toLocaleTimeISO(now.getTime())
? toLocaleTimeISO(now.getTime()).split(':').slice(0, 2).join(':')
: '00:00';
$: dateTime = new Date(`${date}T${time}`);
Expand Down Expand Up @@ -292,7 +293,6 @@
required={true}
min={minTime}
bind:value={time}
step={1}
isMultiple
fullWidth />
</FormItem>
Expand Down

0 comments on commit e7d41b8

Please sign in to comment.