Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Sep 14 18:34
    dalelotts closed #461
  • Sep 14 18:34
    dalelotts commented #461
  • Sep 14 18:33
    dalelotts labeled #461
  • Sep 14 18:33
    dalelotts unlabeled #461
  • Sep 14 18:32
    dalelotts labeled #463
  • Sep 14 18:32
    dalelotts unlabeled #463
  • Sep 14 18:32
    dalelotts unlabeled #463
  • Sep 14 18:32
    dalelotts closed #463
  • Sep 14 18:32
    dalelotts commented #463
  • Sep 14 18:31
    dalelotts labeled #468
  • Sep 14 18:30
    dalelotts unlabeled #468
  • Sep 14 18:30
    dalelotts unlabeled #468
  • Sep 14 18:30
    dalelotts closed #468
  • Sep 14 18:30
    dalelotts commented #468
  • Sep 14 07:16
    byronantak commented #468
  • Sep 14 06:19
    byronantak commented #468
  • Sep 14 01:26
    dalelotts commented #468
  • Sep 14 01:11
    dalelotts edited #468
  • Sep 14 01:10
    dalelotts labeled #468
  • Sep 14 01:10
    dalelotts labeled #468
Dale Lotts
@dalelotts
That's what the user needs to do, so that's what Protractor needs to do. Is it good enough for you only test that selecting a date updates the UI - not that it is a specific date?
Ilia
@noway
I ended up setting underlying date through model, thanks for answerting though
Alex Ivanov
@contributorpw

Hi there! Any ideas to store a date in Firebase. At now I need

{
    "-KgWCD_BRwdpbE2b9pZ4": {
        "datum": "2017-04-06T10:50",
        "datumUTC": 1491475800000,
        "timezoneOffset": -180
    }
}

My settings of the datetimepicker is

data-datetimepicker-config="{ dropdownSelector: '#datum', modelType: 'YYYY-MM-DDThh:mm' }"

I'd like a more advanced feature modelType Something like 'YYYY-MM-DDThh:mm+/-gmthh:mm'

Dale Lotts
@dalelotts
I have not personally used Firebase to store a date, but I would expect them to accept dates in ISO8601 format. You can use any format that moment.js will understand.
Paul W.
@binaryPUNCH
Hi silly question but would the dalelotts bootstrap datetimepicker work in angular4?
Or is there a different recommended alternative?
Dale Lotts
@dalelotts
Hi @amivit, no Angular support yet. I'll start working on it next month if my current contract does not renew.
saikrishnarao2
@saikrishnarao2
Could someone help me I am not able to set the value for angular-datetimepicker dynamically from angularjs controller function?
saikrishnarao2
@saikrishnarao2
I need to set the value of the datetimepicker element.Can you help me on that?
Dale Lotts
@dalelotts
@saikrishnarao2 just set the value on the model. For example, if ngModel="selectedDate", in the controller, setting $scope.selecctedDate will set the value for the date-time-picker and it will be reflected on the UI automatically
saikrishnarao2
@saikrishnarao2
thank you @dalelotts. It worked for me.
TheRealMaxion
@TheRealMaxion
Hi @dalelotts nice work on the directive! A thing I was wondering is if the class on row 19 of the template is a typo, since it looks a bit off that it is "dow" ?
TheRealMaxion
@TheRealMaxion
Also, I was trying to make it possible to navigate the dropdown using the keyboard, and though I was able to open it by setting the input to readonly and giving the span a tabindex, I was unable to navigate to anything useful inside the dropdown despite my limited efforts even with editing your template. Unless @jylertones was able to come up with something then I guess I'll have to make sure the users use the mouse like the others.
TheRealMaxion
@TheRealMaxion
@dalelotts ah never mind the alleged typo, just realized it's short for day of week
Dale Lotts
@dalelotts
@saikrishnarao2 :+1:
@TheRealMaxion good point, I don't think picker currently supports keyboard navigation. Wow, that's a big gap that has been in place for a long time! If you get something working, please let me know! Even better, send me a PR! =)
saikrishnarao2
@saikrishnarao2
Hi @dalelotts.I need another help.How do I set min date and max date in angular for the datetimepicker?
I think this is what you want...
I need to change minutes format inside timepicker, how can I set HH:mm instead of h:mm a?
William Kennedy
@williamknn
moment.locale() didn't change anything
William Kennedy
@williamknn
I wasn't importing my language locale
It's working now
saikrishnarao2
@saikrishnarao2
Thanks @williamknn It worked for me
Bharat Soni
@iiison
This message was deleted
Gareth
@GarethStar_twitter
Hi, how can past dates and times be disabled?
Let's read the docs, folks
Gareth
@GarethStar_twitter
This only seems to disable the dates, but not the times within the dates?
iv worked out how to do a filter for this but its really clunky
Gareth
@GarethStar_twitter
scope.startDateBeforeRender = function ($dates) {
if (!scope.blockHistoric) { return; }
var ranChecker = false;
var dateNow = new Date();
$dates.filter(function (date) {
var utcdate = new Date(date.utcDateValue);
var utc = new Date(utcdate.getTime() + dateNow.getTimezoneOffset() * 60000);
return utc.getTime() < dateNow;
}).forEach(function (date) {
var mo = moment();
var localTime = new Date(date.utcDateValue);
var isDisplayLengthNotDay = date.display.length > 2;
var isToday = mo.isSame(moment(date.utcDateValue), 'day');
var isMonth = mo.isSame(moment(date.utcDateValue), 'month');
var isYear = mo.isSame(moment(date.utcDateValue), 'year');
var isHoursSame = localTime.getHours() == dateNow.getHours();
var isMinutesLess = localTime.getMinutes() < dateNow.getMinutes();
var dateFormat = mo.minute(0).format("h:mm A");
var monthFormat = mo.minute(0).format("MMM");
var yearFormat = mo.minute(0).format("YYYY");
var display = date.display;
var isDisplayDateSame = display == dateFormat;
var isDisplayMonthSame = display == monthFormat;
var isDisplayYearSame = display == yearFormat;
var displaySame = ((isDisplayDateSame && isToday) || (isDisplayMonthSame && isMonth) || (isDisplayYearSame && isYear));
if (!isToday && !displaySame) {
date.selectable = false;
} else if ((((isDisplayLengthNotDay || date.past) || (!isHoursSame && isMinutesLess && !isToday)) && !displaySame) || !ranChecker) {
date.selectable = false;
};
ranChecker = true;
});
}
};
kshee95k
@kshee95k

Having trouble disabling specific dates.

var myAppModule = angular.module('myApp', ['ui.bootstrap.datetimepicker']);
myAppModule.controller('DatePickerController', ['$scope', function($scope) {
$scope.disabled = function(date, mode) {
return ( mode === 'day' && ( date.getDay() === 2 ) ); };
}]);

I have used the code above and doesnt work. Is there a easy way to do it?

Dale Lotts
@dalelotts

This is quite simple once the API is clear. Look at the example in the readme file and adapt it to your logic - https://github.com/dalelotts/angular-bootstrap-datetimepicker#restrict-past-dates-from-being-selected.

Try the following code:

$scope.disabled = function ($view, $dates) {
     if ($view === 'day') {
       $dates.filter(function (date) {
          return date.getDay() === 2;
        }).forEach(function (date) {
          date.selectable = false;
        });
    }
}

your html must also hook up the before-render function named disabled correctly for this to work. See documentation and examples folder.

kshee95k
@kshee95k
do i need the code that i have already written too? or should i delete it?
Dale Lotts
@dalelotts
You should be able to replace your disabled function with the disabled function I provided. I did not test the code at all but it should give you an idea of what you need to do.
kshee95k
@kshee95k
i got it thanks
is there also a way to disable times within the dates?
Dale Lotts
@dalelotts
You disable times the same way as any other date. Implement the logic you want in the before-render callback and set selectable = false for the dates or times you want to disable.
yehhor
@yehhor
@dalelotts Hi, I have the same problem as described in dalelotts/angular-bootstrap-datetimepicker#398. I can't find a way to retrieve the date when I close timepicker without selecting minView. For example, I have minView: 'minute', I open datepicker in dropdown, select day and click somewhere else, datepicker closes and date is not selected - thats the moment when I need datepicker to give me selected timestamp (maybe 00: 00 of that day). Is there such feature?
kshee95k
@kshee95k
im confused. can you elaborate?
kshee95k
@kshee95k
i mean i already have used
var myAppModule = angular.module('myApp', ['ui.bootstrap.datetimepicker']);
// controller
myAppModule.controller('DatePickerController', ['$scope', function($scope) {
// Runs the disable function passing in $view, $dates
$scope.disabled = function ($view, $dates) {
// filters the $view == 'day' so it can disable days = sunday and thursday
if ($view === 'day') {
$dates.filter(function (date) {
// creating notWeirdDate = new Date in order to get the utdDateValue
// as well as defining the function .getDay()
notWeirdDate = new Date(date.utcDateValue);
/
Date is weird. it uses utc format where it goes -1 a day
so for satuday it does 0-1 = 6 (0 is sunday in array format)
and so for thursday its 4-1 = 3 (4 is thursday in array format)
/
return (notWeirdDate.getDay() === 6 || notWeirdDate.getDay() === 3) ;
}).forEach(function (date) {;
date.selectable = false;
});
}
}
}]);
for disabling the dates i want
Dale Lotts
@dalelotts
If the user does not complete the selection process, no date is selected. Can you tell me a bit more about your use case? Specifically, I'd like to understand how the end user will complete their work with this feature implemented.
Also, when posting code, please format it by wrapping it in three back ticks "```"
kshee95k
@kshee95k
My use case is: working on a reservation system for a restaurant. When the restuarant is closed, the time cannot be selected on that particular date. for example, if the restaurant is open on mon from 11AM to 3 PM and 4 PM to 9 PM, i would have to disable from 3:05 to 3:55 PM and 9:05 PM to 10:55 AM
then end user cannot select the times when the restaurant is closed.
However, with my code, I am not sure how i am able to do it. With dates it is easier since the logic seems to be easier. I hope this helps when i explain it to you Dale Lotts
Dale Lotts
@dalelotts
I see, this is quite simple. For hour view, disable any times when the restaurant is closed. I don't see the need for any additional logic in this directive.
kshee95k
@kshee95k
do i disable it the same way i did the dates? or do i need to use a different library