implemented editor for times

This commit is contained in:
2025-08-28 10:18:50 +02:00
parent 5abfa96dc2
commit 49461199cd
5 changed files with 67 additions and 50 deletions

View File

@@ -1,24 +0,0 @@
<script>
let { onSet = (dateTime) => {}, value = ' ' } = $props();
let date = $state(value.split(' ')[0]);
let time = $state(value.split(' ')[1]);
console.log({date:date,time:time,value:value});
function handleSubmit(e){
e.preventDefault();
onSet(`${date} ${time}`);
}
</script>
<style>
button{ display: none }
</style>
<form onsubmit={handleSubmit} >
<input type="date" bind:value={date} />
<input type="time" bind:value={time} />
<button type="submit">ok</button>
</form>

View File

@@ -0,0 +1,37 @@
<script>
import { t } from '../translations.svelte.js';
import MarkdownEditor from './MarkdownEditor.svelte';
let { record = null, onSet = time => {} } = $props();
function onsubmit(e){
e.preventDefault();
onSet(record);
}
</script>
{#if record}
<form {onsubmit}>
<fieldset>
<legend>{t('edit_object',{object:t('record')})}</legend>
<label>
{t('start')}
<input type="datetime-local" bind:value={record.start_time} />
</label>
<label>
{t('end')}
<input type="datetime-local" bind:value={record.end_time} />
</label>
<label>
{t('subject')}
<input type="text" bind:value={record.subject} />
</label>
<label>
{t('description')}
<MarkdownEditor simple={true} bind:value={record.description} />
</label>
<button type="submit">{t('save')}</button>
</fieldset>
</form>
{record.description.source}
{/if}